[ 
https://issues.apache.org/jira/browse/CALCITE-5973?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17761350#comment-17761350
 ] 

Julian Hyde commented on CALCITE-5973:
--------------------------------------

Well, technically it’s not a DDL statement. It’s something you intended to be a 
DDL statement. 



I believe you’d get the same error if write any garbage, e.g. “foo bar”. So 
it’s a legitimate question what would be a useful message in these cases.

What do other databases, e.g. Postgres, do. 

> Parsing DDL error message is inaccurate
> ---------------------------------------
>
>                 Key: CALCITE-5973
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5973
>             Project: Calcite
>          Issue Type: Wish
>          Components: core
>    Affects Versions: 1.32.0
>            Reporter: Echo Lee
>            Priority: Major
>             Fix For: 1.36.0
>
>
> When i parse the following DDL statement:
>  
> {code:java}
> // code placeholder
> reate table t (
>     a int, 
>     b varchar) 
> with('key' = 'value') {code}
>  
> where the create keyword lacks the initial letter c
> The parse method is:
> {code:java}
> // code placeholder
> SqlParser parser = SqlParser.create(sql, config);
> return parser.parseStmt(); {code}
> The exception I get is:
> {code:java}
> // code placeholder
> Caused by: org.apache.calcite.runtime.CalciteException: Non-query expression 
> encountered in illegal context
>     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>     at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
>     at 
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>     at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
>     at 
> org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:505) 
> {code}
> I feel that this exception information is inaccurate.
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to