diff --git a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/dataset/mappers/DatasetMapper.java b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/dataset/mappers/DatasetMapper.java index 781f9ed29f0549..5e1b43b835fc87 100644 --- a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/dataset/mappers/DatasetMapper.java +++ b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/dataset/mappers/DatasetMapper.java @@ -136,9 +136,6 @@ private void mapDatasetProperties(@Nonnull Dataset dataset, @Nonnull DataMap dat properties.setQualifiedName(gmsProperties.getQualifiedName()); dataset.setProperties(properties); dataset.setDescription(properties.getDescription()); - if (gmsProperties.getUri() != null) { - dataset.setUri(gmsProperties.getUri().toString()); - } } private void mapEditableDatasetProperties(@Nonnull Dataset dataset, @Nonnull DataMap dataMap) { diff --git a/li-utils/src/main/javaPegasus/com/linkedin/common/uri/Uri.java b/li-utils/src/main/javaPegasus/com/linkedin/common/uri/Uri.java new file mode 100644 index 00000000000000..ab90b3e054a3b7 --- /dev/null +++ b/li-utils/src/main/javaPegasus/com/linkedin/common/uri/Uri.java @@ -0,0 +1,38 @@ +package com.linkedin.common.uri; + +import java.net.URI; +import java.net.URISyntaxException; + +public class Uri { + private final String _uri; + + public Uri(String url) { + if (url == null) { + throw new NullPointerException("URL must be non-null"); + } + _uri = url; + } + + @Override + public String toString() { + return _uri; + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof Uri)) { + return false; + } else { + return _uri.equals(((Uri) obj)._uri); + } + } + + @Override + public int hashCode() { + return _uri.hashCode(); + } + + public URI toURI() throws URISyntaxException { + return new URI(_uri); + } +} diff --git a/li-utils/src/main/javaPegasus/com/linkedin/common/uri/UriCoercer.java b/li-utils/src/main/javaPegasus/com/linkedin/common/uri/UriCoercer.java new file mode 100644 index 00000000000000..a23d2b08752d17 --- /dev/null +++ b/li-utils/src/main/javaPegasus/com/linkedin/common/uri/UriCoercer.java @@ -0,0 +1,19 @@ +package com.linkedin.common.uri; + +import com.linkedin.data.template.Custom; +import com.linkedin.data.template.DirectCoercer; +import com.linkedin.data.template.TemplateOutputCastException; + +public class UriCoercer implements DirectCoercer { + private static final boolean REGISTER_COERCER = Custom.registerCoercer(new UriCoercer(), Uri.class); + + @Override + public Object coerceInput(Uri object) throws ClassCastException { + return object.toString(); + } + + @Override + public Uri coerceOutput(Object object) throws TemplateOutputCastException { + return new Uri((String) object); + } +} diff --git a/metadata-models/src/main/pegasus/com/linkedin/dataset/DatasetProperties.pdl b/metadata-models/src/main/pegasus/com/linkedin/dataset/DatasetProperties.pdl index eb7dd1dab5d89e..57b1fe76931299 100644 --- a/metadata-models/src/main/pegasus/com/linkedin/dataset/DatasetProperties.pdl +++ b/metadata-models/src/main/pegasus/com/linkedin/dataset/DatasetProperties.pdl @@ -46,6 +46,7 @@ record DatasetProperties includes CustomProperties, ExternalReference { /** * The abstracted URI such as hdfs:///data/tracking/PageViewEvent, file:///dir/file_name. Uri should not include any environment specific properties. Some datasets might not have a standardized uri, which makes this field optional (i.e. kafka topic). */ + @deprecated = "Use ExternalReference.externalUrl field instead." uri: optional Uri /**