[ https://issues.apache.org/jira/browse/CALCITE-2016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16252733#comment-16252733 ]
Shuyi Chen edited comment on CALCITE-2016 at 11/15/17 12:16 AM: ---------------------------------------------------------------- [~julianhyde], I've updated the PR to change the parser to parse subfield as SqlIdentifier, and added a test to make sure that referring to an unknown field gives an error in SqlValidatorTest. Can you take another look at the PR([https://github.com/apache/calcite/pull/557])? Thanks. was (Author: suez1224): [~julianhyde], I've updated the PR to change the parser to parse subfield as SqlIdentifier, and added a test to make sure that referring to an unknown field gives an error in SqlValidatorTest. Can you take another look at the PR[https://github.com/apache/calcite/pull/557]? Thanks. > ITEM + DOT operator does not work for array > ------------------------------------------- > > Key: CALCITE-2016 > URL: https://issues.apache.org/jira/browse/CALCITE-2016 > Project: Calcite > Issue Type: Bug > Components: core > Reporter: Shuyi Chen > Assignee: Julian Hyde > > Query with ITEM + DOT operator for array does not parse. Below is an example > query and its stack trace. > *Query*: {code}SELECT employees[1].empno from dept_nested{code} > *Stacktrace*: > {noformat} > java.lang.RuntimeException: Error while parsing query: SELECT > employees[1].empno from dept_nested > at > org.apache.calcite.sql.test.SqlTesterImpl.parseAndValidate(SqlTesterImpl.java:161) > at > org.apache.calcite.sql.test.SqlTesterImpl.getResultType(SqlTesterImpl.java:148) > at > org.apache.calcite.sql.test.SqlTesterImpl.checkResultType(SqlTesterImpl.java:204) > at > org.apache.calcite.test.SqlValidatorTestCase$Sql.type(SqlValidatorTestCase.java:603) > at > org.apache.calcite.test.SqlValidatorTest.testRecordTypeElided(SqlValidatorTest.java:7715) > 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.InvokeMethod.evaluate(InvokeMethod.java:17) > 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.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) > 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:117) > at > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42) > at > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262) > at > com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84) > 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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) > Caused by: org.apache.calcite.sql.parser.SqlParseException: Encountered "." > at line 1, column 20. > Was expecting one of: > <EOF> > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > "AS" ... > <IDENTIFIER> ... > <QUOTED_IDENTIFIER> ... > <BACK_QUOTED_IDENTIFIER> ... > <BRACKET_QUOTED_IDENTIFIER> ... > <UNICODE_QUOTED_IDENTIFIER> ... > "UNION" ... > "INTERSECT" ... > "EXCEPT" ... > "MINUS" ... > "NOT" ... > "IN" ... > "BETWEEN" ... > "LIKE" ... > "SIMILAR" ... > "=" ... > ">" ... > "<" ... > "<=" ... > ">=" ... > "<>" ... > "!=" ... > "+" ... > "-" ... > "*" ... > "/" ... > "||" ... > "AND" ... > "OR" ... > "IS" ... > "MEMBER" ... > "SUBMULTISET" ... > "CONTAINS" ... > "OVERLAPS" ... > "EQUALS" ... > "PRECEDES" ... > "SUCCEEDS" ... > "MULTISET" ... > "[" ... > > at > org.apache.calcite.sql.parser.impl.SqlParserImpl.convertException(SqlParserImpl.java:349) > at > org.apache.calcite.sql.parser.impl.SqlParserImpl.normalizeException(SqlParserImpl.java:130) > at > org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:138) > at > org.apache.calcite.sql.test.SqlTesterImpl.parseQuery(SqlTesterImpl.java:168) > at > org.apache.calcite.sql.test.SqlTesterImpl.parseAndValidate(SqlTesterImpl.java:159) > ... 32 more > Caused by: org.apache.calcite.sql.parser.impl.ParseException: Encountered "." > at line 1, column 20. > Was expecting one of: > <EOF> > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > "AS" ... > <IDENTIFIER> ... > <QUOTED_IDENTIFIER> ... > <BACK_QUOTED_IDENTIFIER> ... > <BRACKET_QUOTED_IDENTIFIER> ... > <UNICODE_QUOTED_IDENTIFIER> ... > "UNION" ... > "INTERSECT" ... > "EXCEPT" ... > "MINUS" ... > "NOT" ... > "IN" ... > "BETWEEN" ... > "LIKE" ... > "SIMILAR" ... > "=" ... > ">" ... > "<" ... > "<=" ... > ">=" ... > "<>" ... > "!=" ... > "+" ... > "-" ... > "*" ... > "/" ... > "||" ... > "AND" ... > "OR" ... > "IS" ... > "MEMBER" ... > "SUBMULTISET" ... > "CONTAINS" ... > "OVERLAPS" ... > "EQUALS" ... > "PRECEDES" ... > "SUCCEEDS" ... > "MULTISET" ... > "[" ... > > at > org.apache.calcite.sql.parser.impl.SqlParserImpl.generateParseException(SqlParserImpl.java:22153) > at > org.apache.calcite.sql.parser.impl.SqlParserImpl.jj_consume_token(SqlParserImpl.java:21970) > at > org.apache.calcite.sql.parser.impl.SqlParserImpl.SqlStmtEof(SqlParserImpl.java:800) > at > org.apache.calcite.sql.parser.impl.SqlParserImpl.parseSqlStmtEof(SqlParserImpl.java:186) > at > org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:131) > ... 34 more > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)