Skip to content

Commit f8bc02f

Browse files
committed
record fll
1 parent 3dbc42c commit f8bc02f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

database-commons/src/main/java/io/cdap/plugin/db/batch/source/AbstractDBSource.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
import java.util.List;
6464
import java.util.Properties;
6565
import java.util.regex.Pattern;
66+
import java.util.stream.Collectors;
6667
import javax.annotation.Nullable;
6768

6869
/**
@@ -266,7 +267,12 @@ public void prepareRun(BatchSourceContext context) throws Exception {
266267
connectionConfigAccessor.setSchema(schemaStr);
267268
}
268269
LineageRecorder lineageRecorder = new LineageRecorder(context, sourceConfig.referenceName);
269-
lineageRecorder.createExternalDataset(sourceConfig.getSchema());
270+
Schema schema = sourceConfig.getSchema() == null ? schemaFromDB : sourceConfig.getSchema();
271+
lineageRecorder.createExternalDataset(schema);
272+
if (schema != null && schema.getFields() != null) {
273+
lineageRecorder.recordRead("Read", "Read from database plugin",
274+
schema.getFields().stream().map(Schema.Field::getName).collect(Collectors.toList()));
275+
}
270276
context.setInput(Input.of(sourceConfig.referenceName, new SourceInputFormatProvider(
271277
DataDrivenETLDBInputFormat.class, connectionConfigAccessor.getConfiguration())));
272278
}

0 commit comments

Comments
 (0)