[ 
https://issues.apache.org/jira/browse/CALCITE-7793?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18116491#comment-18116491
 ] 

Etienne Pelissier commented on CALCITE-7793:
--------------------------------------------

Documenting the ideas I had during CALCITE-7687:

I wonder if we could centralize the "push expression through Aggregate" logic 
as is done for Project in 
[pushPastProject|https://github.com/apache/calcite/blob/2b794ff5a9e4874905a91d475a2136ce5107aeb0/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java#L3313].

[FilterAggregateTransposeRule.java|https://github.com/apache/calcite/blob/3b0444d98ab2708a4de503f63ea70006b7efeb58/core/src/main/java/org/apache/calcite/rel/rules/FilterAggregateTransposeRule.java#L102]
 is the authoritative source for how to push an expression through an Aggregate 
(I think).
CALCITE-7687 introduced a duplicate pushing logic in 
[RelMdSelectivity|https://github.com/apache/calcite/blob/2b794ff5a9e4874905a91d475a2136ce5107aeb0/core/src/main/java/org/apache/calcite/rel/metadata/RelMdSelectivity.java#L192]
This PR could introduce a new duplicate pushing logic.

Should we implement the fix for this ticket by duplicating the pushing logic, 
and then do a refactor PR that centralizes it in a method (if possible), or do 
something else?

> RelMdDistinctRowCount passes an Aggregate predicate to the Aggregate's input 
> without translating column references
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-7793
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7793
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.42.0
>            Reporter: Mihai Budiu
>            Priority: Major
>
> This is an exact counterpart to CALCITE-7687
> I marked it as "major" since it can potentially lead to incorrect results



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to