You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Michael Mior (JIRA)" <ji...@apache.org> on 2018/04/23 23:19:00 UTC
[jira] [Commented] (CALCITE-2276) Calcite unable to parse ROW value
constructor in certain scenario
[ https://issues.apache.org/jira/browse/CALCITE-2276?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16449027#comment-16449027 ]
Michael Mior commented on CALCITE-2276:
---------------------------------------
The question to me seems to be what the correct behaviour should be.
# What should Calcite accept as a valid query?
# What should be returned when the query is unparsed?
> Calcite unable to parse ROW value constructor in certain scenario
> -----------------------------------------------------------------
>
> Key: CALCITE-2276
> URL: https://issues.apache.org/jira/browse/CALCITE-2276
> Project: Calcite
> Issue Type: Bug
> Components: core
> Reporter: Shuyi Chen
> Assignee: Julian Hyde
> Priority: Major
>
> h2. Original dev mailing list question:
> Now for our production, we can parse a query successfully like this :
> -- correlated IN subquery
> -- TC 01.01
> SELECT t1a,
> t1b,
> t1h
> FROM t1
> WHERE ( t1a, t1h ) NOT IN (SELECT t2a,
> t2h
> FROM t2
> WHERE t2a = t1a
> ORDER BY t2a)
> AND t1a = 'val1a'
> but if we add in `Row`:
> -- correlated IN subquery
> -- TC 01.01
> SELECT t1a,
> t1b,
> t1h
> FROM t1
> WHERE ROW( t1a, t1h ) NOT IN (SELECT t2a,
> t2h
> FROM t2
> WHERE t2a = t1a
> ORDER BY t2a)
> AND t1a = 'val1a'
> it will throw exception:
> Caused by: org.apache.calcite.sql.parser.SqlParseException: ROW expression
> encountered in illegal context
> at
> org.apache.calcite.sql.parser.impl.SqlParserImpl.convertException(SqlParserImpl.java:351)
> at
> org.apache.calcite.sql.parser.impl.SqlParserImpl.normalizeException(SqlParserImpl.java:133)
> at org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:138)
> at org.apache.calcite.sql.parser.SqlParser.parseStmt(SqlParser.java:163)
> at
> org.apache.flink.table.calcite.FlinkPlannerImpl.parse(FlinkPlannerImpl.scala:81)
> ... 8 more
> For the success query, if we exec parsed AST tree rootNode.toString(), it
> will return a query like:
> SELECT `t1a`,
> `t1b`,
> `t1h`
> FROM `t1`
> WHERE ROW(`t1a`, `t1h`) NOT IN (SELECT `t2a`, `t2h`
> FROM `t2`
> WHERE `t2a` = `t1a`
> ORDER BY `t2a`)
> AND `t1a` = 'val1a'
> This is inconsistent by Calcite itself semantic.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)