Skip to content

[FLINK-38832][table-planner] Push down single column when using count star#27681

Open
xuyangzhong wants to merge 1 commit intoapache:masterfrom
xuyangzhong:FLINK-38832
Open

[FLINK-38832][table-planner] Push down single column when using count star#27681
xuyangzhong wants to merge 1 commit intoapache:masterfrom
xuyangzhong:FLINK-38832

Conversation

@xuyangzhong
Copy link
Contributor

What is the purpose of the change

Prunes the input columns of a LogicalAggregate representing COUNT(*) (i. e. no group keys, a single COUNT aggregate call with no arguments and no filter) by inserting a project of a constant literal 0 between the aggregate and its input.
This avoids reading all columns from the source when only counting rows.

Before:
LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
+- SomeInput

After:
LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
+- LogicalProject($f0=[0])
+- SomeInput

Brief change log

  • Add a new rule PruneCountStarInputRule
  • Remove part of unreachable codes in FlinkRelBuilder#aggregate
  • Update plans about existent tests

Verifying this change

Existent tests can cover this change.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented?

@flinkbot
Copy link
Collaborator

flinkbot commented Feb 26, 2026

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants