use of io.openlineage.client.OpenLineage.ParentRunFacet in project OpenLineage by OpenLineage.
the class OpenLineageRunEventBuilder method populateRun.
private RunEvent populateRun(Optional<ParentRunFacet> parentRunFacet, RunEventBuilder runEventBuilder, JobBuilder jobBuilder, List<Object> nodes) {
OpenLineage openLineage = openLineageContext.getOpenLineage();
RunFacetsBuilder runFacetsBuilder = openLineage.newRunFacetsBuilder();
parentRunFacet.ifPresent(runFacetsBuilder::parent);
OpenLineage.JobFacets jobFacets = buildFacets(nodes, jobFacetBuilders, openLineage.newJobFacetsBuilder().build());
List<InputDataset> inputDatasets = buildInputDatasets(nodes);
List<OutputDataset> outputDatasets = buildOutputDatasets(nodes);
openLineageContext.getQueryExecution().flatMap(qe -> unknownEntryFacetListener.build(qe.optimizedPlan())).ifPresent(facet -> runFacetsBuilder.put("spark_unknown", facet));
RunFacets runFacets = buildFacets(nodes, runFacetBuilders, runFacetsBuilder.build());
OpenLineage.RunBuilder runBuilder = openLineage.newRunBuilder().runId(openLineageContext.getRunUuid()).facets(runFacets);
return runEventBuilder.run(runBuilder.build()).job(jobBuilder.facets(jobFacets).build()).inputs(inputDatasets).outputs(outputDatasets).build();
}
Aggregations