Calcite create schema with sql

34 views Asked by At

Is there a way to create a schema for calcite using existing sql for table creation?

Here is my code, for example:

FrameworkConfig config = Frameworks.newConfigBuilder().defaultSchema(defaultSchema).build();

Planner planner = Frameworks.getPlanner(config);

SqlNode parse = planner.parse(sql);

SqlNode validate = planner.validate(parse);

I need to provide a defaultSchema for the config, otherwise the validate will fail.

But I only got a string contains CREATE TABLE A (a int not null);.

How can I generate such a defaultSchema using the sql string like CREATE TABLE A (a int not null);.

I searched for the SchemaFactory of the Calcite but got nothing.

Is there any way to create such a schema?

0

There are 0 answers