Hi Julian,

It works! Thank you very much!
 
From: Julian Hyde
Date: 2022-02-23 10:01
To: dev
Subject: Re: DDL support issues in Calcite
Looks like you need to be using ServerDdlExecutor rather than 
DdlExecutor.USELESS.
 
Therefore try using org.apache.calcite.server.ServerDdlExecutor#PARSER_FACTORY 
rather than org.apache.calcite.sql.parser.ddl.SqlDdlParserImpl#FACTORY in your 
connect string.
 
 
> On Feb 21, 2022, at 12:17 AM, wang...@mchz.com.cn wrote:
> 
> Dear Calcite community:
> 
> I am new Calcite user here. I noted in the document 
> https://calcite.apache.org/docs/adapter.html that Calcite does support DDL 
> operations,the only thing I need to do is 1) to include calcite-server.jar in 
> my classpath and 2) add 
> parserFactory=org.apache.calcite.sql.parser.ddl.SqlDdlParserImpl#FACTORY to 
> JDBC connect string. 
> Now the problem is: I did so, but still I got the following error:
> 
> 
> java.sql.SQLException: Error while executing SQL "CREATE TABLE t (i INTEGER, 
> j VARCHAR(10))": DDL not supported: CREATE TABLE `T` (`I` INTEGER, `J` 
> VARCHAR(10)) at 
> org.apache.calcite.avatica.Helper.createException(Helper.java:56) at 
> org.apache.calcite.avatica.Helper.createException(Helper.java:41) at 
> org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:163)
>  at 
> org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:227)
>  at com.xxxx.CalciteResolverTest.testJdbc(CalciteResolverTest.java:259) at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method) at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
>  at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  at java.base/java.lang.reflect.Method.invoke(Method.java:568) at 
> junit.framework.TestCase.runTest(TestCase.java:177) at 
> junit.framework.TestCase.runBare(TestCase.java:142) at 
> junit.framework.TestResult$1.protect(TestResult.java:122) at 
> junit.framework.TestResult.runProtected(TestResult.java:142) at 
> junit.framework.TestResult.run(TestResult.java:125) at 
> junit.framework.TestCase.run(TestCase.java:130) at 
> junit.framework.TestSuite.runTest(TestSuite.java:241) at 
> junit.framework.TestSuite.run(TestSuite.java:236) at 
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90) 
> at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at 
> com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
>  at 
> com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
>  at 
> com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221)
>  at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) Caused by: 
> java.lang.UnsupportedOperationException: DDL not supported: CREATE TABLE `T` 
> (`I` INTEGER, `J` VARCHAR(10)) at 
> org.apache.calcite.server.DdlExecutor.lambda$static$0(DdlExecutor.java:28) at 
> org.apache.calcite.prepare.CalcitePrepareImpl.executeDdl(CalcitePrepareImpl.java:369)
>  at 
> org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:634)
>  at 
> org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:513)
>  at 
> org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:483)
>  at 
> org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:249)
>  at 
> org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:623)
>  at 
> org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:674)
>  at 
> org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156)
>  ... 20 more
> 
> did I miss any other properties that needs to be set? 
> 
> 
> 
> 
> Many thanks
> Sai Wang
 
 

Reply via email to