[
https://issues.apache.org/jira/browse/CALCITE-5568?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17699019#comment-17699019
]
Julian Hyde commented on CALCITE-5568:
--------------------------------------
[~leepb], When logging a bug, be explicit. Let me use a metaphor. If you car’s
windshield wipers don’t work, you would tell the mechanic. “Here is the car.
See, when I turn on the wipers, nothing happens.” You wouldn’t just leave the
car and expect the mechanic to figure it out.
Do the same here. “Here is a query that includes the SUBSTRING function. I
expected the plan to contain SUBSTRING but it does not.” Do duplicate the
summary as the first line of the description. (If the summary gets changed, you
still want the bug to make sense.)
> LogicalValues causes decorrelate to fail
> ----------------------------------------
>
> Key: CALCITE-5568
> URL: https://issues.apache.org/jira/browse/CALCITE-5568
> Project: Calcite
> Issue Type: Bug
> Reporter: libopeng
> Priority: Major
>
> {code:java}
> SELECT
> (
> SELECT
> ( SUM ( "tbl2"."count" ) ) AS "SUM"
> FROM
> (
> SELECT
> (
> SELECT
> ( COUNT ( "tbl2"."id" ) ) AS "COUNT"
> FROM
> "trip_order" AS "tbl2"
> WHERE
> "tbl1"."province" = "tbl2"."province"
> ) AS "count",
> ( "tbl1"."province" ) AS "province"
> FROM
> "trip_order" AS "tbl1"
> ) AS "tbl2"
> ) AS "sub_1"
> {code}
> after decorrelate
> {code:java}
> LogicalProject(sub_1=[$1])
> LogicalJoin(condition=[true], joinType=[left])
> LogicalValues(tuples=[[{ 0 }]])
> LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])
> LogicalAggregate(group=[{}], SUM=[SUM($0)])
> LogicalProject(count=[$10])
> LogicalProject(id=[$0], gmt_create=[$1], service_begin=[$2],
> driver_id=[$3], passenger_id=[$4], province=[$5], city=[$6],
> service_minute=[$7], service_mileage=[$8], order_amount=[$9], $f0=[$10])
> LogicalProject(id=[$0], gmt_create=[$1], service_begin=[$2],
> driver_id=[$3], passenger_id=[$4], province=[$5], city=[$6],
> service_minute=[$7], service_mileage=[$8], order_amount=[$9], $f0=[$10])
> LogicalCorrelate(correlation=[$cor0], joinType=[left],
> requiredColumns=[{5}])
> LogicalTableScan(table=[[trip_order]])
> LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])
> LogicalAggregate(group=[{}], COUNT=[COUNT()])
> LogicalFilter(condition=[=($cor0.province, $5)])
> LogicalTableScan(table=[[trip_order]]){code}
> [https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java#L491]
>
> Is this as expected?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)