-
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(data quality): update models, add assertions cli with snowflake integration #10602
Merged
jjoyce0510
merged 11 commits into
datahub-project:master
from
mayurinehate:assertion_cli
May 31, 2024
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d044612
feat(data quality): update assertion models
mayurinehate d001e88
assertion graphql definitions, mapping
mayurinehate 3c085d1
asertions cli - upsert, compile
mayurinehate 7b630f0
remove unused graphql mutations and resolvers, fix lint
mayurinehate bc81fc9
changes and tests
mayurinehate 8270077
missing init
mayurinehate eda7a45
more operators and rename some fields
mayurinehate eedd616
lint changes
mayurinehate 92de277
support for freshness assertion, more field value operators
mayurinehate e8eb12e
add graphql tests, remove unused code
mayurinehate f87fcb1
rename filter to filters, update examples
mayurinehate File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -28,8 +28,8 @@ public class AssertionType | |
Constants.ASSERTION_KEY_ASPECT_NAME, | ||
Constants.ASSERTION_INFO_ASPECT_NAME, | ||
Constants.DATA_PLATFORM_INSTANCE_ASPECT_NAME, | ||
Constants.GLOBAL_TAGS_ASPECT_NAME); | ||
|
||
Constants.GLOBAL_TAGS_ASPECT_NAME, | ||
Constants.ASSERTION_ACTIONS_ASPECT_NAME); | ||
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. Do we need this? |
||
private final EntityClient _entityClient; | ||
|
||
public AssertionType(final EntityClient entityClient) { | ||
|
92 changes: 92 additions & 0 deletions
92
...core/src/main/java/com/linkedin/datahub/graphql/types/assertion/FieldAssertionMapper.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,92 @@ | ||
package com.linkedin.datahub.graphql.types.assertion; | ||
|
||
import com.linkedin.assertion.FieldAssertionInfo; | ||
import com.linkedin.datahub.graphql.QueryContext; | ||
import com.linkedin.datahub.graphql.generated.AssertionStdOperator; | ||
import com.linkedin.datahub.graphql.generated.FieldAssertionType; | ||
import com.linkedin.datahub.graphql.generated.FieldMetricType; | ||
import com.linkedin.datahub.graphql.generated.FieldTransformType; | ||
import com.linkedin.datahub.graphql.generated.FieldValuesFailThresholdType; | ||
import com.linkedin.datahub.graphql.types.dataset.mappers.DatasetFilterMapper; | ||
import javax.annotation.Nullable; | ||
|
||
public class FieldAssertionMapper extends AssertionMapper { | ||
|
||
public static com.linkedin.datahub.graphql.generated.FieldAssertionInfo mapFieldAssertionInfo( | ||
@Nullable final QueryContext context, final FieldAssertionInfo gmsFieldAssertionInfo) { | ||
final com.linkedin.datahub.graphql.generated.FieldAssertionInfo result = | ||
new com.linkedin.datahub.graphql.generated.FieldAssertionInfo(); | ||
result.setEntityUrn(gmsFieldAssertionInfo.getEntity().toString()); | ||
result.setType(FieldAssertionType.valueOf(gmsFieldAssertionInfo.getType().name())); | ||
if (gmsFieldAssertionInfo.hasFilter()) { | ||
result.setFilter(DatasetFilterMapper.map(context, gmsFieldAssertionInfo.getFilter())); | ||
} | ||
if (gmsFieldAssertionInfo.hasFieldValuesAssertion()) { | ||
result.setFieldValuesAssertion( | ||
mapFieldValuesAssertion(gmsFieldAssertionInfo.getFieldValuesAssertion())); | ||
} | ||
if (gmsFieldAssertionInfo.hasFieldMetricAssertion()) { | ||
result.setFieldMetricAssertion( | ||
mapFieldMetricAssertion(gmsFieldAssertionInfo.getFieldMetricAssertion())); | ||
} | ||
return result; | ||
} | ||
|
||
private static com.linkedin.datahub.graphql.generated.FieldValuesAssertion | ||
mapFieldValuesAssertion( | ||
final com.linkedin.assertion.FieldValuesAssertion gmsFieldValuesAssertion) { | ||
final com.linkedin.datahub.graphql.generated.FieldValuesAssertion result = | ||
new com.linkedin.datahub.graphql.generated.FieldValuesAssertion(); | ||
result.setField(mapSchemaFieldSpec(gmsFieldValuesAssertion.getField())); | ||
result.setOperator(AssertionStdOperator.valueOf(gmsFieldValuesAssertion.getOperator().name())); | ||
result.setFailThreshold( | ||
mapFieldValuesFailThreshold(gmsFieldValuesAssertion.getFailThreshold())); | ||
result.setExcludeNulls(gmsFieldValuesAssertion.isExcludeNulls()); | ||
|
||
if (gmsFieldValuesAssertion.hasTransform()) { | ||
result.setTransform(mapFieldTransform(gmsFieldValuesAssertion.getTransform())); | ||
} | ||
|
||
if (gmsFieldValuesAssertion.hasParameters()) { | ||
result.setParameters(mapParameters(gmsFieldValuesAssertion.getParameters())); | ||
} | ||
return result; | ||
} | ||
|
||
private static com.linkedin.datahub.graphql.generated.FieldMetricAssertion | ||
mapFieldMetricAssertion( | ||
final com.linkedin.assertion.FieldMetricAssertion gmsFieldMetricAssertion) { | ||
final com.linkedin.datahub.graphql.generated.FieldMetricAssertion result = | ||
new com.linkedin.datahub.graphql.generated.FieldMetricAssertion(); | ||
result.setField(mapSchemaFieldSpec(gmsFieldMetricAssertion.getField())); | ||
result.setMetric(FieldMetricType.valueOf(gmsFieldMetricAssertion.getMetric().name())); | ||
result.setOperator(AssertionStdOperator.valueOf(gmsFieldMetricAssertion.getOperator().name())); | ||
|
||
if (gmsFieldMetricAssertion.hasParameters()) { | ||
result.setParameters(mapParameters(gmsFieldMetricAssertion.getParameters())); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
private static com.linkedin.datahub.graphql.generated.FieldTransform mapFieldTransform( | ||
final com.linkedin.assertion.FieldTransform gmsFieldTransform) { | ||
final com.linkedin.datahub.graphql.generated.FieldTransform result = | ||
new com.linkedin.datahub.graphql.generated.FieldTransform(); | ||
result.setType(FieldTransformType.valueOf(gmsFieldTransform.getType().name())); | ||
return result; | ||
} | ||
|
||
private static com.linkedin.datahub.graphql.generated.FieldValuesFailThreshold | ||
mapFieldValuesFailThreshold( | ||
final com.linkedin.assertion.FieldValuesFailThreshold gmsFieldValuesFailThreshold) { | ||
final com.linkedin.datahub.graphql.generated.FieldValuesFailThreshold result = | ||
new com.linkedin.datahub.graphql.generated.FieldValuesFailThreshold(); | ||
result.setType( | ||
FieldValuesFailThresholdType.valueOf(gmsFieldValuesFailThreshold.getType().name())); | ||
result.setValue(gmsFieldValuesFailThreshold.getValue()); | ||
return result; | ||
} | ||
|
||
private FieldAssertionMapper() {} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
can we please remove?