You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Bastian Köcher <ma...@kchr.de> on 2015/03/30 19:46:17 UTC

SQL parsing and optimization

Hi,
I would like to use Calcite to parse a SQL string and to optimize the 
created plan. Is that possible?
So that I get something like an operator plan which can be executed, but 
I would pass this plan into my own engine.

Sorry, if I send this message twice!

Regards,
Bastian

Re: SQL parsing and optimization

Posted by Julian Hyde <ju...@hydromatic.net>.
Yes, this is exactly what Calcite is intended for.

So it can validate and execute SQL, you need to tell Calcite about your tables. The simplest way of doing this is to write an adapter. In a simple adapter, your table can return an iterator over its contents, and Calcite provides implementations for all other relational operators. See the Csv adapter: https://github.com/apache/incubator-calcite/blob/master/doc/TUTORIAL.md

More complex adapters provide more operators and rules. Also see the Frameworks class, which allows you to drive the parse - validate - plan steps rather than being driven by a JDBC driver.

Julian


> On Mar 30, 2015, at 1:46 PM, Bastian Köcher <ma...@kchr.de> wrote:
> 
> Hi,
> I would like to use Calcite to parse a SQL string and to optimize the created plan. Is that possible?
> So that I get something like an operator plan which can be executed, but I would pass this plan into my own engine.
> 
> Sorry, if I send this message twice!
> 
> Regards,
> Bastian