-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Pawel Leszczynski <[email protected]>
- Loading branch information
1 parent
7b6265d
commit 804adf6
Showing
16 changed files
with
615 additions
and
1 deletion.
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
31 changes: 31 additions & 0 deletions
31
clients/java/src/main/java/marquez/client/models/ColumnLineageNodeData.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,31 @@ | ||
/* | ||
* Copyright 2018-2022 contributors to the Marquez project | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package marquez.client.models; | ||
|
||
import com.fasterxml.jackson.core.type.TypeReference; | ||
import java.util.List; | ||
import lombok.AllArgsConstructor; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.NonNull; | ||
import marquez.client.Utils; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@EqualsAndHashCode | ||
public class ColumnLineageNodeData implements NodeData { | ||
@NonNull String namespace; | ||
@NonNull String dataset; | ||
@NonNull String field; | ||
@NonNull String fieldType; | ||
@NonNull String transformationDescription; | ||
@NonNull String transformationType; | ||
@NonNull List<DatasetFieldId> inputFields; | ||
|
||
public static ColumnLineageNodeData fromJson(@NonNull final String json) { | ||
return Utils.fromJson(json, new TypeReference<ColumnLineageNodeData>() {}); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
clients/java/src/main/java/marquez/client/models/DatasetFieldId.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,16 @@ | ||
/* | ||
* Copyright 2018-2022 contributors to the Marquez project | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package marquez.client.models; | ||
|
||
import lombok.NonNull; | ||
import lombok.Value; | ||
|
||
@Value | ||
public class DatasetFieldId { | ||
@NonNull String namespace; | ||
@NonNull String dataset; | ||
@NonNull String field; | ||
} |
19 changes: 19 additions & 0 deletions
19
clients/java/src/main/java/marquez/client/models/Edge.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,19 @@ | ||
/* | ||
* Copyright 2018-2022 contributors to the Marquez project | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package marquez.client.models; | ||
|
||
import lombok.NonNull; | ||
import lombok.Value; | ||
|
||
@Value | ||
public class Edge { | ||
@NonNull NodeId origin; | ||
@NonNull NodeId destination; | ||
|
||
public static Edge of(@NonNull final NodeId origin, @NonNull final NodeId destination) { | ||
return new Edge(origin, destination); | ||
} | ||
} |
120 changes: 120 additions & 0 deletions
120
clients/java/src/main/java/marquez/client/models/Node.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,120 @@ | ||
/* | ||
* Copyright 2018-2022 contributors to the Marquez project | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package marquez.client.models; | ||
|
||
import static marquez.client.Utils.checkNotBlank; | ||
|
||
import com.fasterxml.jackson.annotation.JsonPropertyOrder; | ||
import com.google.common.collect.ImmutableSet; | ||
import com.google.common.collect.ImmutableSortedSet; | ||
import com.google.common.collect.Sets; | ||
import java.util.Set; | ||
import javax.annotation.Nullable; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.NonNull; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
|
||
@EqualsAndHashCode | ||
@ToString | ||
@JsonPropertyOrder({"id", "type", "data", "inEdges", "outEdges"}) | ||
public final class Node { | ||
@Getter private final NodeId id; | ||
@Getter private final NodeType type; | ||
@Getter @Setter @Nullable private NodeData data; | ||
@Getter private final Set<Edge> inEdges; | ||
@Getter private final Set<Edge> outEdges; | ||
|
||
public Node( | ||
@NonNull final NodeId id, | ||
@NonNull final NodeType type, | ||
@Nullable final NodeData data, | ||
@Nullable final Set<Edge> inEdges, | ||
@Nullable final Set<Edge> outEdges) { | ||
this.id = id; | ||
this.type = type; | ||
this.data = data; | ||
this.inEdges = (inEdges == null) ? ImmutableSet.of() : ImmutableSortedSet.copyOf(inEdges); | ||
this.outEdges = (outEdges == null) ? ImmutableSet.of() : ImmutableSortedSet.copyOf(outEdges); | ||
} | ||
|
||
public static Builder dataset() { | ||
return new Builder(NodeType.DATASET); | ||
} | ||
|
||
public static Builder datasetField() { | ||
return new Builder(NodeType.DATASET_FIELD); | ||
} | ||
|
||
public static Builder job() { | ||
return new Builder(NodeType.JOB); | ||
} | ||
|
||
public static Builder run() { | ||
return new Builder(NodeType.RUN); | ||
} | ||
|
||
public boolean hasInEdges() { | ||
return !inEdges.isEmpty(); | ||
} | ||
|
||
public boolean hasOutEdges() { | ||
return !outEdges.isEmpty(); | ||
} | ||
|
||
public static final class Builder { | ||
private NodeId id; | ||
private final NodeType type; | ||
private NodeData data; | ||
private Set<Edge> inEdges; | ||
private Set<Edge> outEdges; | ||
|
||
private Builder(@NonNull final NodeType type) { | ||
this.type = type; | ||
this.inEdges = ImmutableSet.of(); | ||
this.outEdges = ImmutableSet.of(); | ||
} | ||
|
||
public Builder id(@NonNull String idString) { | ||
return id(NodeId.of(checkNotBlank(idString))); | ||
} | ||
|
||
public Builder id(@NonNull NodeId id) { | ||
this.id = id; | ||
return this; | ||
} | ||
|
||
public Builder data(@Nullable NodeData data) { | ||
this.data = data; | ||
return this; | ||
} | ||
|
||
public Builder inEdges(@NonNull Edge... inEdges) { | ||
this.inEdges = Sets.newHashSet(inEdges); | ||
return this; | ||
} | ||
|
||
public Builder inEdges(@Nullable Set<Edge> inEdges) { | ||
this.inEdges = (inEdges == null) ? ImmutableSet.of() : inEdges; | ||
return this; | ||
} | ||
|
||
public Builder outEdges(@NonNull Edge... outEdges) { | ||
this.outEdges = Sets.newHashSet(outEdges); | ||
return this; | ||
} | ||
|
||
public Builder outEdges(@Nullable Set<Edge> outEdges) { | ||
this.outEdges = (outEdges == null) ? ImmutableSet.of() : outEdges; | ||
return this; | ||
} | ||
|
||
public Node build() { | ||
return new Node(id, type, data, inEdges, outEdges); | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
clients/java/src/main/java/marquez/client/models/NodeData.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,16 @@ | ||
/* | ||
* Copyright 2018-2022 contributors to the Marquez project | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package marquez.client.models; | ||
|
||
import com.fasterxml.jackson.annotation.JsonSubTypes; | ||
import com.fasterxml.jackson.annotation.JsonTypeInfo; | ||
|
||
@JsonTypeInfo( | ||
use = JsonTypeInfo.Id.NAME, | ||
include = JsonTypeInfo.As.EXTERNAL_PROPERTY, | ||
property = "type") | ||
@JsonSubTypes({@JsonSubTypes.Type(value = ColumnLineageNodeData.class, name = "DATASET_FIELD")}) | ||
public interface NodeData {} |
Oops, something went wrong.