Skip to content

Commit 4662e51

Browse files
addressing review comments
Signed-off-by: Prachi Mishra <prachi.mishra@astronomer.io>
1 parent 52ebaa3 commit 4662e51

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

api/src/main/java/marquez/db/LineageDao.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,12 @@ WHERE ds.uuid IN (<dsUuids>)""")
132132
List<Run> getCurrentRunsWithFacets(@BindList Collection<UUID> jobUuid);
133133

134134
@SqlQuery(
135-
"SELECT DISTINCT on(r.job_name, r.namespace_name) r.*, jv.version as job_version\n"
136-
+ " FROM runs_view r\n"
137-
+ " INNER JOIN job_versions jv ON jv.uuid=r.job_version_uuid\n"
138-
+ " INNER JOIN jobs_view j ON j.uuid=jv.job_uuid\n"
139-
+ " WHERE j.uuid in (<jobUuid>) OR j.symlink_target_uuid IN (<jobUuid>)\n"
140-
+ " ORDER BY r.job_name, r.namespace_name, created_at DESC\n")
135+
"""
136+
SELECT DISTINCT on(r.job_name, r.namespace_name) r.*, jv.version as job_version
137+
FROM runs_view r
138+
INNER JOIN job_versions jv ON jv.uuid=r.job_version_uuid
139+
INNER JOIN jobs_view j ON j.uuid=jv.job_uuid
140+
WHERE j.uuid in (<jobUuid>) OR j.symlink_target_uuid IN (<jobUuid>)
141+
ORDER BY r.job_name, r.namespace_name, created_at DESC""")
141142
List<Run> getCurrentRuns(@BindList Collection<UUID> jobUuid);
142143
}

api/src/main/java/marquez/service/LineageService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public LineageService(LineageDao delegate, JobDao jobDao) {
4646
this.jobDao = jobDao;
4747
}
4848

49+
// TODO make input parameters easily extendable if adding more options like 'withJobFacets'
4950
public Lineage lineage(NodeId nodeId, int depth, boolean withRunFacets) {
5051
Optional<UUID> optionalUUID = getJobUuid(nodeId);
5152
if (optionalUUID.isEmpty()) {
@@ -61,7 +62,6 @@ public Lineage lineage(NodeId nodeId, int depth, boolean withRunFacets) {
6162
jobData.stream().map(JobData::getUuid).collect(Collectors.toSet()))
6263
: getCurrentRuns(jobData.stream().map(JobData::getUuid).collect(Collectors.toSet()));
6364

64-
// todo fix runtime
6565
for (JobData j : jobData) {
6666
if (j.getLatestRun().isEmpty()) {
6767
for (Run run : runs) {

0 commit comments

Comments
 (0)