[
https://issues.apache.org/jira/browse/CALCITE-4192?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17184981#comment-17184981
]
lifangzheng commented on CALCITE-4192:
--------------------------------------
hi, [~danny0405], thanks for advising.
I mean when a relNode has optimized by AggregateProjectMergeRule, the
RelMdColumnOrigins#getColumnOrigins(Aggregate, RelMetadataQuery, int) get the
wrong column origins.
one case like this:
{code:java}
@Test void testColumnOriginAfterAggProjectMergeRule() throws Exception {
final String sql = "select count(ename), SAL from emp group by SAL";
final RelNode rel = tester.convertSqlToRel(sql).rel;
final HepProgramBuilder programBuilder = HepProgram.builder();
programBuilder.addRuleInstance(AggregateProjectMergeRule.Config.DEFAULT.toRule());
final HepPlanner planner = new HepPlanner(programBuilder.build());
planner.setRoot(rel);
RelNode finalRel = planner.findBestExp();
Set<RelColumnOrigin> origins =
RelMetadataQuery.instance().getColumnOrigins(finalRel, 1);
assertThat(origins.size(), equalTo(1));
RelColumnOrigin columnOrigin = origins.iterator().next();
assertThat(columnOrigin.getOriginColumnOrdinal(), equalTo(5));
assertThat(columnOrigin.getOriginTable().getRowType().getFieldNames().get(5),
equalTo("SAL"));
}
{code}
> When the relNode has passed the AggregateProjectMergeRule rule, it will be
> wrong to calculate the column blood relationship through RelMdColumnOrigins
> tool
> -----------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CALCITE-4192
> URL: https://issues.apache.org/jira/browse/CALCITE-4192
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.25.0
> Reporter: lifangzheng
> Priority: Major
> Labels: pull-request-available
> Fix For: next
>
> Attachments: image-2020-08-25-15-53-19-575.png,
> image-2020-08-25-15-55-31-702.png, image-2020-08-25-16-16-34-185.png
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> !image-2020-08-25-15-53-19-575.png|width=415,height=280!
>
> !image-2020-08-25-15-55-31-702.png|width=423,height=270!
>
>
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)