[
https://issues.apache.org/jira/browse/CALCITE-1960?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16141347#comment-16141347
]
Rheet Wong commented on CALCITE-1960:
-------------------------------------
https://github.com/apache/calcite/pull/530 [~julianhyde]
The iterator generate more result in RelMdPredicates#ExprsItr.
When compute next mapping, if it has no more element(t < 0) and the level is
not 0, then it go next level recursively, and the current level need restart.
now it reset iterationIdx to 0, when it will go the next level recursively,
the upper level is still the last element instead of the first one. So when
next, we restart set nextMapping and iterationIdx like initializeMapping, or it
go the next level recursively, the upper level is still the last element
instead of the first one.
The class ExprsItr is not public, so it make test cases hardly. We can cast
ExprsItr to public or don't make test cases.
> Duplicated mapping generated from RelMdPredicates
> -------------------------------------------------
>
> Key: CALCITE-1960
> URL: https://issues.apache.org/jira/browse/CALCITE-1960
> Project: Calcite
> Issue Type: Bug
> Components: core
> Reporter: Rheet Wong
> Assignee: Julian Hyde
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> When inferring pulled up predicates, multiple mappings are generated to
> make sure equivalent expressions can be substitute. E.g., for an expression
> 'a + b + c' and the following equivalences:
> {code:sql}
> a : {a, b}
> b : {a, b}
> c : {c, e}
> {code}
> should generate:
> {code:sql}
> a + a + c
> a + a + e
> a + b + c
> a + b + e
> b + a + c
> b + a + e
> b + b + c
> b + b + e
> {code}
> The mapping generation is a typical permutation generation process. However,
> the current code is not handling the permutation well, thus causing
> duplicated
> mappings.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)