Greetings to dev@calcite:
I am currently working on extracting RelNodes from DML queries with schemas
derived from DDL statements, and I have encountered a few issues:
1. My current method to derive schemas from DDL statements is
(a) connect to "jdbc:calcite" with parser factory set to
ServerDdlExecutor.ParserFactory
(b) execute the DDL statements
(c) extract schema with connection.getRootSchem()
Currently simple create statements can be correctly executed. However,
the execution (at
org.apache.calcite.server.ServerDdlExecutor.execute(ServerDdlExecutor.java:472))
will fail when constraints (e.g. PRIMARY KEY) are involved. The CREATE
statement I used is pasted below:
CREATE TABLE EMP (EMP_ID INTEGER NOT NULL,
EMP_NAME VARCHAR,
DEPT_ID INTEGER,
PRIMARY KEY (DEPT_ID))
Is there a way to fix this? Or is there a better way to derive schema
from DDL statements?
2. It seems that currently PlannerImpl.rel(SqlNode) decorrelate (at
PlannerImpl.java:265) the RelRoot converted from SqlNode, regardless what
the RelBuilderConfig was passed in to the planner. Is there a way to bypass
such a transformation to RelNode and fetch the raw RelRoot converted from
SqlNode by SqlToRelConverter in PlannerImpl?
I would appreciate any insights into anything related. Thanks in advance!
Sincerely,
Arthur Pan