Search in sources :

Example 1 with RelationRecord

use of io.cdap.cdap.proto.metadata.lineage.RelationRecord in project cdap by cdapio.

the class LineageSerializer method toLineageRecord.

public static LineageRecord toLineageRecord(long start, long end, Lineage lineage, Set<CollapseType> collapseTypes) {
    Set<RelationRecord> relationBuilder = new HashSet<>();
    Map<String, ProgramRecord> programBuilder = new HashMap<>();
    Map<String, DataRecord> dataBuilder = new HashMap<>();
    Set<CollapsedRelation> collapsedRelations = LineageCollapser.collapseRelations(lineage.getRelations(), collapseTypes);
    for (CollapsedRelation relation : collapsedRelations) {
        String dataKey = makeDataKey(relation.getData());
        String programKey = makeProgramKey(relation.getProgram());
        RelationRecord relationRecord = new RelationRecord(dataKey, programKey, convertAccessType(relation.getAccess()), convertRuns(relation.getRuns()), convertComponents(relation.getComponents()));
        relationBuilder.add(relationRecord);
        programBuilder.put(programKey, new ProgramRecord(relation.getProgram()));
        dataBuilder.put(dataKey, new DataRecord(relation.getData()));
    }
    return new LineageRecord(start, end, relationBuilder, programBuilder, dataBuilder);
}
Also used : RelationRecord(io.cdap.cdap.proto.metadata.lineage.RelationRecord) ProgramRecord(io.cdap.cdap.proto.metadata.lineage.ProgramRecord) HashMap(java.util.HashMap) LineageRecord(io.cdap.cdap.proto.metadata.lineage.LineageRecord) DataRecord(io.cdap.cdap.proto.metadata.lineage.DataRecord) HashSet(java.util.HashSet)

Example 2 with RelationRecord

use of io.cdap.cdap.proto.metadata.lineage.RelationRecord in project cdap by caskdata.

the class LineageSerializer method toLineageRecord.

public static LineageRecord toLineageRecord(long start, long end, Lineage lineage, Set<CollapseType> collapseTypes) {
    Set<RelationRecord> relationBuilder = new HashSet<>();
    Map<String, ProgramRecord> programBuilder = new HashMap<>();
    Map<String, DataRecord> dataBuilder = new HashMap<>();
    Set<CollapsedRelation> collapsedRelations = LineageCollapser.collapseRelations(lineage.getRelations(), collapseTypes);
    for (CollapsedRelation relation : collapsedRelations) {
        String dataKey = makeDataKey(relation.getData());
        String programKey = makeProgramKey(relation.getProgram());
        RelationRecord relationRecord = new RelationRecord(dataKey, programKey, convertAccessType(relation.getAccess()), convertRuns(relation.getRuns()), convertComponents(relation.getComponents()));
        relationBuilder.add(relationRecord);
        programBuilder.put(programKey, new ProgramRecord(relation.getProgram()));
        dataBuilder.put(dataKey, new DataRecord(relation.getData()));
    }
    return new LineageRecord(start, end, relationBuilder, programBuilder, dataBuilder);
}
Also used : RelationRecord(io.cdap.cdap.proto.metadata.lineage.RelationRecord) ProgramRecord(io.cdap.cdap.proto.metadata.lineage.ProgramRecord) HashMap(java.util.HashMap) LineageRecord(io.cdap.cdap.proto.metadata.lineage.LineageRecord) DataRecord(io.cdap.cdap.proto.metadata.lineage.DataRecord) HashSet(java.util.HashSet)

Aggregations

DataRecord (io.cdap.cdap.proto.metadata.lineage.DataRecord)2 LineageRecord (io.cdap.cdap.proto.metadata.lineage.LineageRecord)2 ProgramRecord (io.cdap.cdap.proto.metadata.lineage.ProgramRecord)2 RelationRecord (io.cdap.cdap.proto.metadata.lineage.RelationRecord)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2