-
Notifications
You must be signed in to change notification settings - Fork 320
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
Column lineage graph endpoint #2124
Merged
Merged
Changes from all commits
Commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright 2018-2022 contributors to the Marquez project | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package marquez.api; | ||
|
||
import static javax.ws.rs.core.MediaType.APPLICATION_JSON; | ||
|
||
import com.codahale.metrics.annotation.ExceptionMetered; | ||
import com.codahale.metrics.annotation.ResponseMetered; | ||
import com.codahale.metrics.annotation.Timed; | ||
import java.time.Instant; | ||
import java.util.concurrent.ExecutionException; | ||
import javax.validation.constraints.NotNull; | ||
import javax.ws.rs.DefaultValue; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.QueryParam; | ||
import javax.ws.rs.core.Response; | ||
import lombok.NonNull; | ||
import lombok.extern.slf4j.Slf4j; | ||
import marquez.service.ServiceFactory; | ||
import marquez.service.models.NodeId; | ||
|
||
@Slf4j | ||
@Path("/api/v1/column-lineage") | ||
public class ColumnLineageResource extends BaseResource { | ||
|
||
private static final String DEFAULT_DEPTH = "20"; | ||
|
||
public ColumnLineageResource(@NonNull final ServiceFactory serviceFactory) { | ||
super(serviceFactory); | ||
} | ||
|
||
@Timed | ||
@ResponseMetered | ||
@ExceptionMetered | ||
@GET | ||
@Produces(APPLICATION_JSON) | ||
public Response getLineage( | ||
@QueryParam("nodeId") @NotNull NodeId nodeId, | ||
@QueryParam("depth") @DefaultValue(DEFAULT_DEPTH) int depth) | ||
throws ExecutionException, InterruptedException { | ||
return Response.ok(columnLineageService.lineage(nodeId, depth, Instant.now())).build(); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
api/src/main/java/marquez/common/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,27 @@ | ||
/* | ||
* Copyright 2018-2022 contributors to the Marquez project | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package marquez.common.models; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
|
||
/** ID for {@code DatasetField}. */ | ||
@EqualsAndHashCode | ||
@AllArgsConstructor | ||
@ToString | ||
public class DatasetFieldId { | ||
|
||
@Getter private final DatasetId datasetId; | ||
@Getter private final FieldName fieldName; | ||
|
||
public static DatasetFieldId of(String namespace, String datasetName, String field) { | ||
return new DatasetFieldId( | ||
new DatasetId(NamespaceName.of(namespace), DatasetName.of(datasetName)), | ||
FieldName.of(field)); | ||
} | ||
} |
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
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.
Most important piece of the PR: recursive query to extract column-lineage graph.
Only
column_lineage
table is used and joined to obtained graph nodes.Other tables are only used to enrich found nodes.