I intend to get the list of all columns used in current SQL from all source tables. For instance:
Table X(int a, String b, String e)
Table Y(String c, String d)
SELECT
X.a
Y.c
from X
join Y on X.b = Y.c
...
;
Then the expected output should be {"X": ["a","b"], "Y": ["c"]}, X.e
and Y.d
should not appear in the result since they are not used in the previous SQL.
Any idea how to achieve this in Flink SQL? Thanks.