Skip to content

Aggregation Functions Containing Constants Cannot Be Pushed Down to TableScan Nodes #26474

@dc-orz

Description

@dc-orz

version: 464

Aggregation functions containing constants (e.g., approx_percentile) cannot be pushed down to TableScan nodes. This occurs because a ProjectNode with constant mappings exists between the AggregationNode and TableScanNode, which prevents the PushAggregationIntoTableScan rule from being triggered. Additionally, the PushProjectionIntoTableScan rule does not push constant projections down to connectors. This means the ProjectNode between the AggregationNode and TableScanNode cannot be eliminated.

The logical execution plan appears as follows:

  • AggregationNode

    • ProjectNode (constant mapping)

      • TableScanNode

I believe handling this case in PushAggregationIntoTableScan would be more appropriate. I have successfully implemented this by extracting and expanding constants into the AggregateFunction parameters within the SPI package in PushAggregationIntoTableScan. Perhaps I can submit a PR for this later.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions