Hi, Sandeep If I'm understanding you correctly, it seems that you wanna find a way to transfer a SqlNode or RelNode to SQL statement. As far as I know, you can take a look at SqlNode, where the SqlNode can be transferred to SQL expression through toString() method. And, RelToSqlConverterTest illustrates how to assemble a SQL by RelNode.
Hope it’s helpful for you. Best, Zhe Hu On 11/24/2021 18:38,Sandeep Nayak<[email protected]> wrote: Hello, I have been looking for a library which will allow me to use an object tree to generate a SQL. Calcite came up in my search but after taking a look at the codebase my conclusion is that Calcite provides the ability to parse SQL statements into an object tree represented as SQLNode (and derived classes) instances which subsequently can be used to perform optimizations by generating relational algebra for the logical query. Calcite however does not provide classes which can be used to assemble a tree and generate SQL statements. From the contracts at least SQLNode takes in a Parser position and there are no other contracts which indicate such an option. Can someone confirm if this is inaccurate? If not Calcite, are there other open source libraries out there which allow this? Thanks in advance. -Sandeep
