Hello,

I am currently experimenting with Calcite to try to outperform a home-made
parser that we use to analyze SQL queries ran on Hive. We are extracting
the input tables and the projected fields from SQL queries, and I am
wondering how to do the same with Calcite.
I can currently validate the queries against the Schema generated from the
Hive Metastore with Calcite. However I haven't been able to find any logic
to extract this information from the validated SqlNode.
It seems that I could do it by first converting my query to a relational
algebra, and then push the projections and filters down to the inputs
using, for instance, the HepPlanner. By then calling rel.getInputs() on the
optimized plan, I should be able to have most of the information I need,
but that requires the optimizer to always be able to always be able to push
the filters and projections down to the sources, which may not necessarily
be the case.
Is this approach correct? Is there any better way to do this, or do you
know of any code that I could have a look at to better understand how to
use Calcite for this?

Thanks a lot!

Benoit

Reply via email to