Skip to content

chore(optimizer): enabling config for ReplaceFilterTop1 by default - #27305

Open
saadtajwar wants to merge 1 commit into
apache:mainfrom
saadtajwar:saadtajwar/enable-row-number-to-aggregate-default
Open

saadtajwar wants to merge 1 commit into
apache:mainfrom
saadtajwar:saadtajwar/enable-row-number-to-aggregate-default

Conversation

@saadtajwar

@saadtajwar saadtajwar commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

ReplaceFilterTop1 rewrites Filter(row_number() = 1) over a PARTITION BY window into a first_value aggregate - the rewrite was gated behind datafusion.optimizer.enable_row_number_to_aggregate, which defaulted to false - this PR enables this by default

What changes are included in this PR?

  • Set enable_row_number_to_aggregate default to true in datafusion/common/src/config.rs and remove the “disabled by default” documentation on that option
  • Regenerated docs/source/user-guide/configs.md
  • Updated information_schema.slt expectations for the new default and description text
  • Updated row_number_to_aggregate.slt comments
  • Updated the module doc on ReplaceFilterTop1 to note the option is on by default

Are there user-facing changes?

Yes, top-1 row_number() + filter patterns are rewritten to first_value aggregates unless the optimizer option is set to false.

@saadtajwar

saadtajwar commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor Author

cc @zhuqi-lucas & @alamb - thanks again for the help with this! Ready for review, follow-up from #23824 :)

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.

Enable enable_row_number_to_aggregate by default

1 participant