forked from datahub-project/datahub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(lineage) Add column-level impact analysis feature (datahub-proje…
- Loading branch information
1 parent
e82b3c5
commit 1627155
Showing
41 changed files
with
989 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
...ql-core/src/main/java/com/linkedin/datahub/graphql/types/schemafield/SchemaFieldType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package com.linkedin.datahub.graphql.types.schemafield; | ||
|
||
import com.linkedin.common.urn.Urn; | ||
import com.linkedin.common.urn.UrnUtils; | ||
import com.linkedin.datahub.graphql.QueryContext; | ||
import com.linkedin.datahub.graphql.generated.Entity; | ||
import com.linkedin.datahub.graphql.generated.EntityType; | ||
import com.linkedin.datahub.graphql.generated.SchemaFieldEntity; | ||
import com.linkedin.datahub.graphql.types.common.mappers.UrnToEntityMapper; | ||
import graphql.execution.DataFetcherResult; | ||
|
||
import javax.annotation.Nonnull; | ||
import java.util.List; | ||
import java.util.function.Function; | ||
import java.util.stream.Collectors; | ||
|
||
public class SchemaFieldType implements com.linkedin.datahub.graphql.types.EntityType<SchemaFieldEntity, String> { | ||
|
||
public SchemaFieldType() { } | ||
|
||
@Override | ||
public EntityType type() { | ||
return EntityType.SCHEMA_FIELD; | ||
} | ||
|
||
@Override | ||
public Function<Entity, String> getKeyProvider() { | ||
return Entity::getUrn; | ||
} | ||
|
||
@Override | ||
public Class<SchemaFieldEntity> objectClass() { | ||
return SchemaFieldEntity.class; | ||
} | ||
|
||
@Override | ||
public List<DataFetcherResult<SchemaFieldEntity>> batchLoad(@Nonnull List<String> urns, @Nonnull QueryContext context) throws Exception { | ||
final List<Urn> schemaFieldUrns = urns.stream() | ||
.map(UrnUtils::getUrn) | ||
.collect(Collectors.toList()); | ||
|
||
try { | ||
return schemaFieldUrns.stream() | ||
.map(this::mapSchemaFieldUrn) | ||
.map(schemaFieldEntity -> DataFetcherResult.<SchemaFieldEntity>newResult() | ||
.data(schemaFieldEntity) | ||
.build() | ||
) | ||
.collect(Collectors.toList()); | ||
|
||
} catch (Exception e) { | ||
throw new RuntimeException("Failed to load schemaField entity", e); | ||
} | ||
} | ||
|
||
private SchemaFieldEntity mapSchemaFieldUrn(Urn urn) { | ||
try { | ||
SchemaFieldEntity result = new SchemaFieldEntity(); | ||
result.setUrn(urn.toString()); | ||
result.setType(EntityType.SCHEMA_FIELD); | ||
result.setFieldPath(urn.getEntityKey().get(1)); | ||
Urn parentUrn = Urn.createFromString(urn.getEntityKey().get(0)); | ||
result.setParent(UrnToEntityMapper.map(parentUrn)); | ||
return result; | ||
} catch (Exception e) { | ||
throw new RuntimeException("Failed to load schemaField entity", e); | ||
} | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.