0

I am using Flink Sql to parse sql's lineage. I use flink planner to parse a sql as

insert into target_table(dest_f1, dest_f2) select source_f1, source_f2 from source_table

Obviously, source_f1 is the source of dest_f1.

When I get a CatalogSinkModifyOperation via Flink planner, the CatalogSinkModifyOperation doesn't contains any insert columns information, which means no dest_f1, dest_f2.

How can I get the insert columns' name from my target_table?

slo
  • 23
  • 5

1 Answers1

0

You can use the following code to get the column information of the target table:

List<String> targetColumnList = tableEnv.from(sinkTable)
        .getResolvedSchema()
        .getColumnNames();

or

relNode.getRowType().getFieldNames()

If you want to parse the lineage of the flink sql field, you can refer to my open source project: https://github.com/HamaWhiteGG/flink-sql-lineage

Ryan M
  • 18,333
  • 31
  • 67
  • 74
HamaWhite
  • 1
  • 2