You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Kenneth Knowles (JIRA)" <ji...@apache.org> on 2018/10/19 18:23:00 UTC
[jira] [Created] (CALCITE-2634) Query parses but fails to convert
to rel
Kenneth Knowles created CALCITE-2634:
----------------------------------------
Summary: Query parses but fails to convert to rel
Key: CALCITE-2634
URL: https://issues.apache.org/jira/browse/CALCITE-2634
Project: Calcite
Issue Type: Improvement
Reporter: Kenneth Knowles
Assignee: Julian Hyde
The following query parses but fails to convert to logical rels:
{code:sql}
WITH BidCount (auction, num, hopstart) AS (
SELECT
Bid.auction,
count(*),
HOP_START(Bid.dateTime, INTERVAL '1' SECOND, INTERVAL '60' SECOND)
FROM Bid
GROUP BY
Bid.auction,
HOP(Bid.dateTime, INTERVAL '1' SECOND, INTERVAL '60' SECOND)
)
SELECT HotAuction.auction, HotAuction.num, HotAuction.hopstart
FROM BidCount as HotAuction
WHERE HotAuction.num >= ALL (
SELECT num FROM BidCount
WHERE HotAuction.hopstart = BidCount.hopstart)
{code}
The validated SQL node pretty prints like so:
{code:sql}
WITH `BidCount` (`auction`, `num`, `hopstart`) AS (SELECT `Bid`.`auction`, COUNT(*), HOP_START(`Bid`.`dateTime`, INTERVAL '5' SECOND, INTERVAL '10' SECOND)
FROM `beam`.`Bid` AS `Bid`
GROUP BY `Bid`.`auction`, HOP(`Bid`.`dateTime`, INTERVAL '5' SECOND, INTERVAL '10' SECOND)) (SELECT `HotAuction`.`auction`, `HotAuction`.`num`, `HotAuction`.`hopstart`
FROM `BidCount` AS `HotAuction`
WHERE `HotAuction`.`num` >= ALL (SELECT `BidCount`.`num`
FROM `BidCount` AS `BidCount`
WHERE `HotAuction`.`hopstart` = `BidCount`.`hopstart`))
{code}
The stack trace is here:
{code:java}
java.lang.ClassCastException: org.apache.calcite.rel.logical.LogicalFilter cannot be cast to org.apache.calcite.rel.core.Join
at org.apache.calcite.sql2rel.SqlToRelConverter.translateIn(SqlToRelConverter.java:1242)
at org.apache.calcite.sql2rel.SqlToRelConverter.substituteSubQuery(SqlToRelConverter.java:1129)
at org.apache.calcite.sql2rel.SqlToRelConverter.replaceSubQueries(SqlToRelConverter.java:997)
at org.apache.calcite.sql2rel.SqlToRelConverter.convertWhere(SqlToRelConverter.java:964)
at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectImpl(SqlToRelConverter.java:643)
at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelect(SqlToRelConverter.java:621)
at org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:3051)
at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:557)
at org.apache.calcite.sql2rel.SqlToRelConverter.convertWith(SqlToRelConverter.java:3891)
at org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:3065)
at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:557)
at oorg.apache.calcite.prepare.PlannerImpl.rel(PlannerImpl.java:235)
{code}
For context, this is working with Beam SQL but the failure occurs before any Beam-related code is reached: [https://github.com/apache/beam/pull/6757/files]
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)