-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/Add-support-for-ingesting-schema…
…s-from-schema-registry' into Add-support-for-ingesting-schemas-from-schema-registry
- Loading branch information
Showing
77 changed files
with
5,351 additions
and
16 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
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
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.