-
Notifications
You must be signed in to change notification settings - Fork 325
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
upstream run level lineage implementation #2658
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b4944d7
upstream run level lineage implementation
julienledem 2007c82
fix ordering and spurious nulls bug
julienledem 059c7da
move runs table out of the recursion
julienledem 400644a
add comments and small improvement to the query
julienledem a118c06
add tests
julienledem 50a8ed5
Merge branch 'main' into upstream
julienledem 61da280
add openapi spec
julienledem 870557f
review feedback: improve tests; query
julienledem 5f99805
Merge branch 'main' into upstream
julienledem 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
55 changes: 55 additions & 0 deletions
55
api/src/main/java/marquez/db/mappers/UpstreamRunRowMapper.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,55 @@ | ||
/* | ||
* Copyright 2018-2023 contributors to the Marquez project | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package marquez.db.mappers; | ||
|
||
import static marquez.db.Columns.stringOrNull; | ||
import static marquez.db.Columns.stringOrThrow; | ||
import static marquez.db.Columns.timestampOrNull; | ||
import static marquez.db.Columns.uuidOrThrow; | ||
|
||
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
import java.util.Optional; | ||
import java.util.UUID; | ||
import lombok.NonNull; | ||
import marquez.common.models.DatasetName; | ||
import marquez.common.models.JobName; | ||
import marquez.common.models.NamespaceName; | ||
import marquez.common.models.RunId; | ||
import marquez.db.Columns; | ||
import marquez.db.LineageDao.DatasetSummary; | ||
import marquez.db.LineageDao.JobSummary; | ||
import marquez.db.LineageDao.RunSummary; | ||
import marquez.db.LineageDao.UpstreamRunRow; | ||
import org.jdbi.v3.core.mapper.RowMapper; | ||
import org.jdbi.v3.core.statement.StatementContext; | ||
|
||
/** Maps the upstream query result set to a UpstreamRunRow */ | ||
public final class UpstreamRunRowMapper implements RowMapper<UpstreamRunRow> { | ||
@Override | ||
public UpstreamRunRow map(@NonNull ResultSet results, @NonNull StatementContext context) | ||
throws SQLException { | ||
return new UpstreamRunRow( | ||
new JobSummary( | ||
new NamespaceName(stringOrThrow(results, "job_namespace")), | ||
new JobName(stringOrThrow(results, "job_name")), | ||
Optional.ofNullable(stringOrNull(results, "job_version_uuid")) | ||
.map(UUID::fromString) | ||
.orElse(null)), | ||
new RunSummary( | ||
new RunId(uuidOrThrow(results, "r_uuid")), | ||
timestampOrNull(results, Columns.STARTED_AT), | ||
timestampOrNull(results, Columns.ENDED_AT), | ||
stringOrThrow(results, Columns.STATE)), | ||
results.getObject("dataset_name") == null | ||
? null | ||
: new DatasetSummary( | ||
new NamespaceName(stringOrThrow(results, "dataset_namespace")), | ||
new DatasetName(stringOrThrow(results, "dataset_name")), | ||
UUID.fromString(stringOrThrow(results, "dataset_version_uuid")), | ||
new RunId(UUID.fromString(stringOrThrow(results, "u_r_uuid"))))); | ||
} | ||
} |
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.
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.
Please mind documenting this in
openapi.spec
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.
done