[
https://issues.apache.org/jira/browse/CALCITE-4525?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17839735#comment-17839735
]
Jasmin Trada edited comment on CALCITE-4525 at 4/22/24 3:15 PM:
----------------------------------------------------------------
I faced the same issue, I've added this test in
org.apache.calcite.test.RelMetadataTest and it should pass as all the three
columns refers to a constant column, but it only considers the last one as
constant column...
{{
/**
* Unit test for
* {@link
org.apache.calcite.rel.metadata.RelMdPredicates#getPredicates(Project,
RelMetadataQuery)}.
*/
@Test public void testPullUpPredicatesFromProject() {
final String sql = "select MGR, MGR as manager, MGR as manager1 from
(select * from emp where MGR = 0)";
final RelNode rel = convertSql(sql);
final RelMetadataQuery mq = RelMetadataQuery.instance();
RelOptPredicateList inputSet = mq.getPulledUpPredicates(rel);
ImmutableList<RexNode> pulledUpPredicates = inputSet.pulledUpPredicates;
assertThat(pulledUpPredicates, sortsAs("[=($0, 0), =($1, 0), =($2, 0)]"));
}
}}
was (Author: JIRAUSER297048):
I faced the same issue, I've added this test in
org.apache.calcite.test.RelMetadataTest and it should pass as all the three
columns refers to a constant column, but it only considers the last one as
constant column...
{{{quote}/**
* Unit test for
* {@link
org.apache.calcite.rel.metadata.RelMdPredicates#getPredicates(Project,
RelMetadataQuery)}.
*/
@Test public void testPullUpPredicatesFromProject() {
final String sql = "select MGR, MGR as manager, MGR as manager1 from
(select * from emp where MGR = 0)";
final RelNode rel = convertSql(sql);
final RelMetadataQuery mq = RelMetadataQuery.instance();
RelOptPredicateList inputSet = mq.getPulledUpPredicates(rel);
ImmutableList<RexNode> pulledUpPredicates = inputSet.pulledUpPredicates;
assertThat(pulledUpPredicates, sortsAs("[=($0, 0), =($1, 0), =($2, 0)]"));
}{quote}}}
> Pull up predicate will lost some predicates when project contains same
> RexInputRef.
> ------------------------------------------------------------------------------------
>
> Key: CALCITE-4525
> URL: https://issues.apache.org/jira/browse/CALCITE-4525
> Project: Calcite
> Issue Type: Improvement
> Reporter: Ziwei Liu
> Assignee: Ziwei Liu
> Priority: Major
>
> If project like this a=$0, b=$0
> Pull up predicate is $0='a'
> when pull up through project, predicate will only contain b='a'
--
This message was sent by Atlassian Jira
(v8.20.10#820010)