Andrew, I’m not very sure if I got your idea right. Do you want a promoted `Sql` compared to the original ? Then you should transform Calcite’s RelNodes tree to sql, but Calcite do not support this yet, The SqlNode unparse to sql is actually supported.
It is not that equivalent for RelNodes tree and sql text, e.g. How to describe a SemiJoin in sql ? Another question is the pure text to data source will actually have another planning phrase, we can not make sure this plan is the best and efficient. Best, Danny Chan 在 2019年4月18日 +0800 AM5:22,Andrew O <[email protected]>,写道: > I'm interested in using Calcite in a "no execute" mode that would > effectively return the optimized SQL but not actually execute it. The > intention would be to leverage a) the query planning / optimization b) the > support for outputting different SQL dialects. > > I can see some Tests (e.g. JdbcTest.java) use CalciteAssert and that it has > a check "planHasSql" function. This seems to use a Hook to capture the sql > as part of the execution flow, so is not quite what I'm trying to do. > > I appreciate Calcite attempts to provide abstractions for different > execution layers to allow cross adaptor function, so in theory a single SQL > statement may not always be available. However in my context I know it > will be executing only against a single JDBC source and not other types. > > Is there any suggested / recommended approaches to this, or pointers to > bits of code to look at? > > Thanks in advance > > Andrew
