Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-19092

Parse comment on computed column failed

    XMLWordPrintableJSON

Details

    Description

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

      {{}}

      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'
      )

       

      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:
      

      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

      Attachments

        Issue Links

          Activity

            People

              nicholasjiang Nicholas Jiang
              leonard Leonard Xu
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: