[jira] [Created] (FLINK-19092) Parse comment on computed column failed

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-19092) Parse comment on computed column failed

Shang Yuanchun (Jira)
Leonard Xu created FLINK-19092:
----------------------------------

             Summary: Parse comment on computed column failed
                 Key: FLINK-19092
                 URL: https://issues.apache.org/jira/browse/FLINK-19092
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / API
            Reporter: Leonard Xu
             Fix For: 1.12.0


Parser Exception will be thrown when add comment on computed column,

{{}}
{code:java}
CREATE TABLE test (
  `id` BIGINT,
  `age` INT COMMENT 'test comment', //PASS
  `nominal_age` as age + 1 COMMENT 'test comment' // FAIL
) WITH (
  'connector' = 'values',
  'data-id' = '$dataId'
){code}
 
{code:java}
org.apache.flink.table.api.SqlParserException: SQL parse failed. Encountered "COMMENT" at line 6, column 28.org.apache.flink.table.api.SqlParserException: SQL parse failed. Encountered "COMMENT" at line 6, column 28.Was expecting one of:    ")" ...    "," ...    "." ...    "NOT" ...    "IN" ...    "<" ...    "<=" ...    ">" ...    ">=" ...    "=" ...    "<>" ...    "!=" ...    "BETWEEN" ...    "LIKE" ...    "SIMILAR" ...    "+" ...    "-" ...    "*" ...    "/" ...    "%" ...    "||" ...    "AND" ...    "OR" ...    "IS" ...    "MEMBER" ...    "SUBMULTISET" ...    "CONTAINS" ...    "OVERLAPS" ...    "EQUALS" ...    "PRECEDES" ...    "SUCCEEDS" ...    "IMMEDIATELY" ...    "MULTISET" ...    "[" ...    "FORMAT" ...    
 at org.apache.flink.table.planner.calcite.CalciteParser.parse(CalciteParser.java:56) at org.apache.flink.table.planner.delegation.ParserImpl.parse(ParserImpl.java:76) at org.apache.flink.table.api.internal.TableEnvironmentImpl.executeSql(TableEnvironmentImpl.java:659) at org.apache.flink.table.planner.runtime.stream.sql.LookupJoinITCase.createLookupTable(LookupJoinITCase.scala:96) at org.apache.flink.table.planner.runtime.stream.sql.LookupJoinITCase.before(LookupJoinITCase.scala:72) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:239) at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48) at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55) at org.junit.rules.RunRules.evaluate(RunRules.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:27) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48) at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48) at org.junit.rules.RunRules.evaluate(RunRules.java:20) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:27) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)Caused by: org.apache.calcite.sql.parser.SqlParseException: Encountered "COMMENT" at line 6, column 28.Was expecting one of:
{code}
we should support it as the Flink doc[1] described:

<computed_column_definition>: column_name AS computed_column_expression [COMMENT column_comment] 

 

[1][https://ci.apache.org/projects/flink/flink-docs-master/dev/table/sql/create.html]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)