Hi, Yogendra
there is an utility method RelOptUtil#findAllTables that looks for all
tables in the rel tree. It doesn't collect column names, but you can
adopt it for this purpose.
It seems to me that solution with visitor should also work fine.
--
Roman Kondakov
On 07.02.2022 12:45, Zhe Hu wrote:
Hi, Sharma.
As far as I can tell, Calcite doesn’t provide a simple way to get table names
or column names for a query(or maybe I miss something).
But you can take a look at SqlSelect、SqlOrderBy and SqlWith if you want to do
such things. Based on my own experience, SqlVisitor seems the only way to get
table/column names or alias by visiting the SqlNode, at least that’s how I
extract tables/columns、distinguish SQL type or rewriting SQL in practice.
Hope it’s helpful for you.
Best,
ZheHu
On 02/5/2022 18:39,Yogendra Sharma<s...@live.com> wrote:
Hi Community,
I had to gather the list of all fully qualified table names and thier column
names used(referenced) jn a SELECT query.
I simply parsed the query and wrote a visitor to visit the SqlNode recursively.
While its working (may be with few bugs here and there), i am wondering if
Calcite would already be doing it somewhere ir if there is an easier way to
achieve this?
Thanks
Y
Get Outlook for Android<https://aka.ms/ghei36>