In the test suite, we use Hook.QUERY_PLAN to add handlers. You could do the 
same. The Elasticsearch adapter will call the handler with the query.

See 
https://github.com/apache/calcite/blob/4bc916619fd286b2c0cc4d5c653c96a68801d74e/core/src/main/java/org/apache/calcite/runtime/Hook.java#L95
 
<https://github.com/apache/calcite/blob/4bc916619fd286b2c0cc4d5c653c96a68801d74e/core/src/main/java/org/apache/calcite/runtime/Hook.java#L95>
 and code that references Hook.QUERY_PLAN.

Julian



> On Dec 22, 2021, at 1:13 AM, Divya Murthy <diya.mur...@gmail.com> wrote:
> 
> Hi,
> 
> I am new to Apache Calcite and have been exploring it's usage. I wanted to
> figure out if there is a way to capture the Elasticsearch query generated
> by Calcite.
> 
> I see that we can plugin our own optimizers and validators - but wanted to
> know how to get the final Elasticsearch query that is generated by Apache
> Calcite?
> 
> Thanks,
> Divya

Reply via email to