-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(models) : Joins (Datasets) schema, resolvers and UI #8325
Changes from 14 commits
da18715
bdf2bc6
eeba4cb
89e8782
0c22848
35ea6ca
5ff65c5
03319c1
a819bfa
0cd6323
f84a576
badcb44
996bcce
0b9246a
6d123c1
2550337
7d3680b
1a4967b
6173ce4
2c7e901
a3c8f0c
60ee9e8
fca944c
8c1d018
3f0d55e
2d87628
d0f3b45
c99b654
e08fa36
73f5993
fdff95f
3fc0ba2
cd8d480
6ca1bb4
b317a90
0d29228
1442f3a
084ca29
f0af033
3d8991e
7a00ade
6a6ebf8
c7cf14c
3139b8b
80484c3
795f663
c0a64f3
d784cad
9368a21
d2fa626
7299279
7cd52b2
b4c74fb
34df52b
e4deef1
ba32a4e
96c5d6d
3675766
f25663a
e7916f2
9ce4607
6847170
4715295
75499a7
b53de1c
e337e32
3da6cdb
ac87425
085e472
5a03193
6325729
d122996
8e727c3
07c6a18
7c0d45f
91ac7d9
226fa40
43bc95c
2369e07
dd09115
2831bf6
aab5d0a
d9e0e5f
6952bab
a0a7264
f2f8023
80bdd98
724145e
7422b4b
3da6c48
0fd67ce
39623ac
faf98b6
693b37c
71cc165
c984965
15cf41c
8c46b16
860006d
1dc9631
97817f3
5ce698f
36ace22
0690c2d
4e569d2
eda02f7
94220c5
15b7334
6f4d1b1
ce7d553
40da935
004eac0
9ebb047
5b54652
49d9e55
4d50ae2
79694d7
99ded17
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,12 +61,15 @@ | |
import com.linkedin.datahub.graphql.generated.GlossaryTermAssociation; | ||
import com.linkedin.datahub.graphql.generated.IngestionSource; | ||
import com.linkedin.datahub.graphql.generated.InstitutionalMemoryMetadata; | ||
import com.linkedin.datahub.graphql.generated.Join; | ||
import com.linkedin.datahub.graphql.generated.JoinProperties; | ||
import com.linkedin.datahub.graphql.generated.LineageRelationship; | ||
import com.linkedin.datahub.graphql.generated.ListAccessTokenResult; | ||
import com.linkedin.datahub.graphql.generated.ListOwnershipTypesResult; | ||
import com.linkedin.datahub.graphql.generated.ListDomainsResult; | ||
import com.linkedin.datahub.graphql.generated.ListGroupsResult; | ||
import com.linkedin.datahub.graphql.generated.ListQueriesResult; | ||
import com.linkedin.datahub.graphql.generated.ListJoinResult; | ||
import com.linkedin.datahub.graphql.generated.ListTestsResult; | ||
import com.linkedin.datahub.graphql.generated.ListViewsResult; | ||
import com.linkedin.datahub.graphql.generated.MLFeature; | ||
|
@@ -92,6 +95,7 @@ | |
import com.linkedin.datahub.graphql.generated.Test; | ||
import com.linkedin.datahub.graphql.generated.TestResult; | ||
import com.linkedin.datahub.graphql.generated.UserUsageCounts; | ||
import com.linkedin.datahub.graphql.resolvers.AuthenticatedResolver; | ||
import com.linkedin.datahub.graphql.resolvers.MeResolver; | ||
import com.linkedin.datahub.graphql.resolvers.assertion.AssertionRunEventResolver; | ||
import com.linkedin.datahub.graphql.resolvers.assertion.DeleteAssertionResolver; | ||
|
@@ -296,6 +300,7 @@ | |
import com.linkedin.datahub.graphql.types.tag.TagType; | ||
import com.linkedin.datahub.graphql.types.test.TestType; | ||
import com.linkedin.datahub.graphql.types.view.DataHubViewType; | ||
import com.linkedin.datahub.graphql.types.join.JoinType; | ||
import com.linkedin.entity.client.EntityClient; | ||
import com.linkedin.metadata.config.DataHubConfiguration; | ||
import com.linkedin.metadata.config.IngestionConfiguration; | ||
|
@@ -421,6 +426,7 @@ public class GmsGraphQLEngine { | |
private final DataHubPolicyType dataHubPolicyType; | ||
private final DataHubRoleType dataHubRoleType; | ||
private final SchemaFieldType schemaFieldType; | ||
private final JoinType joinType; | ||
private final DataHubViewType dataHubViewType; | ||
private final QueryType queryType; | ||
private final DataProductType dataProductType; | ||
|
@@ -518,6 +524,7 @@ public GmsGraphQLEngine(final GmsGraphQLEngineArgs args) { | |
this.dataHubPolicyType = new DataHubPolicyType(entityClient); | ||
this.dataHubRoleType = new DataHubRoleType(entityClient); | ||
this.schemaFieldType = new SchemaFieldType(); | ||
this.joinType = new JoinType(entityClient); | ||
this.dataHubViewType = new DataHubViewType(entityClient); | ||
this.queryType = new QueryType(entityClient); | ||
this.dataProductType = new DataProductType(entityClient); | ||
|
@@ -552,6 +559,7 @@ public GmsGraphQLEngine(final GmsGraphQLEngineArgs args) { | |
dataHubPolicyType, | ||
dataHubRoleType, | ||
schemaFieldType, | ||
joinType, | ||
dataHubViewType, | ||
queryType, | ||
dataProductType, | ||
|
@@ -615,6 +623,7 @@ public void configureRuntimeWiring(final RuntimeWiring.Builder builder) { | |
configureTestResultResolvers(builder); | ||
configureRoleResolvers(builder); | ||
configureSchemaFieldResolvers(builder); | ||
configureJoinResolvers(builder); | ||
configureEntityPathResolvers(builder); | ||
configureViewResolvers(builder); | ||
configureQueryEntityResolvers(builder); | ||
|
@@ -701,6 +710,9 @@ private void configureDataPlatformInstanceResolvers(final RuntimeWiring.Builder | |
|
||
private void configureQueryResolvers(final RuntimeWiring.Builder builder) { | ||
builder.type("Query", typeWiring -> typeWiring | ||
.dataFetcher("join", new AuthenticatedResolver<>( | ||
new LoadableTypeResolver<>(joinType, | ||
(env) -> env.getArgument(URN_FIELD_NAME)))) | ||
.dataFetcher("appConfig", | ||
new AppConfigResolver(gitVersion, analyticsService != null, | ||
this.ingestionConfiguration, | ||
|
@@ -740,6 +752,7 @@ private void configureQueryResolvers(final RuntimeWiring.Builder builder) { | |
.dataFetcher("glossaryTerm", getResolver(glossaryTermType)) | ||
.dataFetcher("glossaryNode", getResolver(glossaryNodeType)) | ||
.dataFetcher("domain", getResolver((domainType))) | ||
.dataFetcher("join", getResolver(joinType)) | ||
.dataFetcher("dataPlatform", getResolver(dataPlatformType)) | ||
.dataFetcher("mlFeatureTable", getResolver(mlFeatureTableType)) | ||
.dataFetcher("mlFeature", getResolver(mlFeatureType)) | ||
|
@@ -842,6 +855,8 @@ private void configureMutationResolvers(final RuntimeWiring.Builder builder) { | |
.dataFetcher("updateDataFlow", new MutableTypeResolver<>(dataFlowType)) | ||
.dataFetcher("updateCorpUserProperties", new MutableTypeResolver<>(corpUserType)) | ||
.dataFetcher("updateCorpGroupProperties", new MutableTypeResolver<>(corpGroupType)) | ||
.dataFetcher("updateJoin", new AuthenticatedResolver<>(new MutableTypeResolver<>(joinType))) | ||
.dataFetcher("createJoin", new MutableTypeResolver<>(joinType)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we have started moving away from using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Two new resolvers added: UpdateJoinResolver and CreateJoinResolver |
||
.dataFetcher("addTag", new AddTagResolver(entityService)) | ||
.dataFetcher("addTags", new AddTagsResolver(entityService)) | ||
.dataFetcher("batchAddTags", new BatchAddTagsResolver(entityService)) | ||
|
@@ -991,6 +1006,12 @@ private void configureGenericEntityResolvers(final RuntimeWiring.Builder builder | |
.map(Domain::getUrn) | ||
.collect(Collectors.toList()))) | ||
) | ||
.type("ListJoinResult", typeWiring -> typeWiring | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. may need to remove this if not doing the list joins endpoint There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed - listJoin is removed |
||
.dataFetcher("join", new LoadableTypeBatchResolver<>(joinType, | ||
(env) -> ((ListJoinResult) env.getSource()).getJoin().stream() | ||
.map(Join::getUrn) | ||
.collect(Collectors.toList()))) | ||
) | ||
.type("GetRootGlossaryTermsResult", typeWiring -> typeWiring | ||
.dataFetcher("terms", new LoadableTypeBatchResolver<>(glossaryTermType, | ||
(env) -> ((GetRootGlossaryTermsResult) env.getSource()).getTerms().stream() | ||
|
@@ -1396,6 +1417,46 @@ private void configureTypeExtensions(final RuntimeWiring.Builder builder) { | |
builder.scalar(GraphQLLong); | ||
} | ||
|
||
/** | ||
* Configures resolvers responsible for resolving the {@link Join} type. | ||
*/ | ||
private void configureJoinResolvers(final RuntimeWiring.Builder builder) { | ||
builder | ||
.type("Join", typeWiring -> typeWiring | ||
.dataFetcher("privileges", new EntityPrivilegesResolver(entityClient)) | ||
.dataFetcher("relationships", new EntityRelationshipsResultResolver(graphClient)) | ||
.dataFetcher("browsePaths", new EntityBrowsePathsResolver(this.joinType)) | ||
.dataFetcher("container", | ||
new LoadableTypeResolver<>(containerType, | ||
(env) -> { | ||
final Join join = env.getSource(); | ||
return join.getContainer() != null ? join.getContainer().getUrn() : null; | ||
}) | ||
)) | ||
.type("JoinProperties", typeWiring -> typeWiring | ||
.dataFetcher("datasetA", | ||
new LoadableTypeResolver<>(datasetType, | ||
(env) -> { | ||
final JoinProperties joinProperties = env.getSource(); | ||
return joinProperties.getDatasetA() != null ? joinProperties.getDatasetA().getUrn() : null; | ||
})) | ||
.dataFetcher("datasetB", | ||
new LoadableTypeResolver<>(datasetType, | ||
(env) -> { | ||
final JoinProperties joinProperties = env.getSource(); | ||
return joinProperties.getDatasetB() != null ? joinProperties.getDatasetB().getUrn() : null; | ||
})) | ||
) | ||
.type("Owner", typeWiring -> typeWiring | ||
.dataFetcher("owner", new OwnerTypeResolver<>(ownerTypes, | ||
(env) -> ((Owner) env.getSource()).getOwner())) | ||
) | ||
.type("InstitutionalMemoryMetadata", typeWiring -> typeWiring | ||
.dataFetcher("author", new LoadableTypeResolver<>(corpUserType, | ||
(env) -> ((InstitutionalMemoryMetadata) env.getSource()).getAuthor().getUrn())) | ||
); | ||
} | ||
|
||
/** | ||
* Configures resolvers responsible for resolving the {@link com.linkedin.datahub.graphql.generated.DataJob} type. | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AuthenticatedResolver
is actually deprecated and an authentication check is handled elsewhere so if the user isn't logged in they can't get to any of these endpoints! so feel free to remove it from here as well as belowThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also i see duplicate
"join"
entries here inconfigureQueryResolvers
so I think you can just remove this one entirely.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed