[
https://issues.apache.org/jira/browse/CALCITE-5370?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17629747#comment-17629747
]
Benchao Li commented on CALCITE-5370:
-------------------------------------
bq. After the `onMatch` method of rule AGGREGATE_REMOVE, it converts the
RelNode into a RelSubset
This is the right behavior in {{VolcanoPlanner}}.
Could you tell us how you are using Calcite? E.g., what rules are you using,
what's the steps to reproduce this issue.
> AGGREGATE_REMOVE will convert certain SQL statement into RelSubSet
> ------------------------------------------------------------------
>
> Key: CALCITE-5370
> URL: https://issues.apache.org/jira/browse/CALCITE-5370
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.32.0
> Reporter: alaneuler
> Priority: Major
>
> SQL:
> {code:java}
> SELECT name, sum(count_inner)
> FROM
> (SELECT name, COUNT(*) AS count_inner
> FROM pt_lsb
> GROUP BY name
> ORDER BY count_inner LIMIT 100)
> GROUP BY name {code}
> Table:
> {code:java}
> CREATE TABLE IF NOT EXISTS `pt_lsb` (name VARCHAR(20) NOT NULL) {code}
> After the `onMatch` method of rule AGGREGATE_REMOVE, it converts the RelNode
> into a RelSubset and this RelSubset cannot be converted into a SQL string:
> Error:
> {code:java}
> Exception in thread "main" java.lang.AssertionError: Need to implement
> org.apache.calcite.plan.volcano.RelSubset
> at
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:170)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> at
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
> at
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.base/java.lang.reflect.Method.invoke(Method.java:568)
> at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
> at
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.dispatch(RelToSqlConverter.java:139)
> at
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.visitInput(RelToSqlConverter.java:147)
> at
> org.apache.calcite.rel.rel2sql.SqlImplementor.visitInput(SqlImplementor.java:216)
> at
> org.apache.calcite.rel.rel2sql.SqlImplementor.visitInput(SqlImplementor.java:204)
> at
> org.apache.calcite.rel.rel2sql.SqlImplementor.visitRoot(SqlImplementor.java:180)
> at
> me.alaneuler.calcite.ng.demo.util.SqlUtils.toSqlString(SqlUtils.java:13)
> at
> me.alaneuler.calcite.ng.demo.util.SqlUtils.toSqlString(SqlUtils.java:17)
> at me.alaneuler.calcite.ng.demo.AggRemoveMain.main(AggRemoveMain.java:51)
> Suppressed: java.lang.Throwable: Error while converting RelNode to
> SqlNode:
> HepRelVertex(subset=[rel#17:RelSubset#0.NONE.[]]) at
> org.apache.calcite.util.Util.throwAsRuntime(Util.java:967)
> at
> org.apache.calcite.rel.rel2sql.SqlImplementor.visitRoot(SqlImplementor.java:182)
> ... 3 more {code}
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)