The Calcite framework is not a databse, it is a set of tools for parsing and 
optimizing queries. It does include validation, but not really "execution".  
Calcite does not include a storage layer.

Calcite does include a layer that can execute queries, but I think it is mainly 
used for testing. One way Calcite is used is to generate SQL which can then be 
sent to one or more databases for execution. (Calcite supports federated 
queries, where part of a query is executed on a database, and another part on 
another database).

For parsing SQL with Calcite there should be plenty of examples on the internet.
Here's one I found with a quick search: 
https://medium.com/@knoldus/parsing-database-query-with-apache-calcite-8d1567de3ffa

Mihai
________________________________
From: Shiv K <[email protected]>
Sent: Saturday, July 6, 2024 7:50 PM
To: [email protected] <[email protected]>
Subject: Using Apache Calcite to query postgres like database

Hi team

I am trying to get started with Apache Calcite and do not have very strong
java development skills.

I am trying below, while the first print - prints out the list of tables -
once added to rootSchema - the subsequent print from rootSchema object
prints blank. I do not understand why this is the case.

           Schema schema = JdbcSchema.create(rootSchema, "db1", ds,
                    null, "public");
            Set<String> listTables = schema.getTableNames();
            System.out.println("Tables are " + listTables);

            rootSchema.add("db1", schema);
            Set<String> listTables1 = rootSchema.getTableNames();
            System.out.println("Tables are " + listTables1);

Kindly provide guidance on building the schema and getting started
with parsing queries using Apache Calcite. I have tried going through many
examples on the web - however while I see a lot of calls to the calcite
classes - there are no examples that include validation of the executed
statements and hence I am still in the process of figuring out how to
use Apache Calcite for query parsing and execution.

Your guidance and support will be greatly appreciated!

Thanks much and regards
Shiva

Reply via email to