Skip to content

Conversation

@vim89
Copy link
Owner

@vim89 vim89 commented Jul 28, 2025

Which issue does this PR close?

Rationale for this change

EmptyExec previously returned "unknown" statistics for both global and partition-level queries, which impacts planner accuracy. This change provides exact-zero stats for EmptyExec, aligning with how other operators like AggregateExec and PlaceholderRowExec handle partition statistics.

What changes are included in this PR?

  • Implemented partition_statistics(...) for EmptyExec:
    • Sets num_rows and total_byte_size to Precision::Exact(0)
    • Populates column_statistics with one ColumnStatistics::new_unknown() per schema field
  • Added unit test empty_multi_partition_statistics:
    • Verifies default 1-partition behavior: global and partition 0 return zero stats, invalid partition errors
    • Verifies 2-partition behavior: partitions 0 and 1 return zero stats, invalid partition errors
  • Added a TreeRender branch to DisplayAs to provide informative display of the operator:
    "EmptyExec: partitions=X, fields=Y"
  • No other execution plans or tests were modified

Are these changes tested?

Yes.

  • New test covers all relevant edge cases.
  • The full test suite still passes without regressions.

Are there any user-facing changes?

No.
This change affects internal planner behavior only; no public APIs or outputs are changed.

@vim89 vim89 merged commit 368656c into main Jul 28, 2025
52 of 53 checks passed
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.

Implement partition_statistics API for more operators

2 participants