Hi Julian, I've created JIRA
https://issues.apache.org/jira/browse/CALCITE-2016 for the issue. Could you
please help take a look? I can help with the PR also. Thanks a lot.

Shuyi

On Wed, Oct 18, 2017 at 11:52 AM, Shuyi Chen <[email protected]> wrote:

> I just tried, it throw the same exception. I'll log a JIRA.
>
> On Wed, Oct 18, 2017 at 11:20 AM, Julian Hyde <[email protected]> wrote:
>
>> That sucks. Probably it’s a bug in the parser. Can you please log a JIRA
>> case.
>>
>> As a workaround, try parentheses:
>>
>>   SELECT (employees[1]).empno from dept_nested
>>
>> Julian
>>
>> > On Oct 18, 2017, at 11:15 AM, Shuyi Chen <[email protected]> wrote:
>> >
>> > Hi, It seems that the following query won't parse in Calcite. How can we
>> > fix it, or do I miss something? Thanks a lot.
>> >
>> > SELECT employees[1].empno from dept_nested
>> >
>> > Below is the error:
>> >
>> >
>> > java.lang.RuntimeException: Error while parsing query: SELECT
>> > employees[1].empno from dept_nested
>> >
>> >       at org.apache.calcite.sql.test.SqlTesterImpl.parseAndValidate(S
>> qlTesterImpl.java:161)
>> >       at org.apache.calcite.sql.test.SqlTesterImpl.getResultType(SqlT
>> esterImpl.java:148)
>> >       at org.apache.calcite.sql.test.SqlTesterImpl.checkResultType(Sq
>> lTesterImpl.java:204)
>> >       at org.apache.calcite.test.SqlValidatorTestCase$Sql.type(SqlVal
>> idatorTestCase.java:603)
>> >       at org.apache.calcite.test.SqlValidatorTest.testRecordTypeElide
>> d(SqlValidatorTest.java:7715)
>> >       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> >       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
>> ssorImpl.java:62)
>> >       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
>> thodAccessorImpl.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(Refl
>> ectiveCallable.java:12)
>> >       at org.junit.runners.model.FrameworkMethod.invokeExplosively(Fr
>> ameworkMethod.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(BlockJUnit
>> 4ClassRunner.java:78)
>> >       at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit
>> 4ClassRunner.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.prepareStreamsA
>> ndStart(JUnitStarter.java:262)
>> >       at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStart
>> er.java:84)
>> >       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> >       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
>> ssorImpl.java:62)
>> >       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
>> thodAccessorImpl.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.convertExce
>> ption(SqlParserImpl.java:349)
>> >       at org.apache.calcite.sql.parser.impl.SqlParserImpl.normalizeEx
>> ception(SqlParserImpl.java:130)
>> >       at org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser
>> .java:138)
>> >       at org.apache.calcite.sql.test.SqlTesterImpl.parseQuery(SqlTest
>> erImpl.java:168)
>> >       at org.apache.calcite.sql.test.SqlTesterImpl.parseAndValidate(S
>> qlTesterImpl.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.generatePar
>> seException(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.parseSqlStm
>> tEof(SqlParserImpl.java:186)
>> >       at org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser
>> .java:131)
>> >       ... 34 more
>> >
>> >
>> > "So you have to trust that the dots will somehow connect in your
>> future."
>>
>>
>
>
> --
> "So you have to trust that the dots will somehow connect in your future."
>



-- 
"So you have to trust that the dots will somehow connect in your future."

Reply via email to