Skip to content

[branch-50] fix: Implement AggregateUDFImpl::reverse_expr for StringAgg (#17165) (#17473) - #17544

Merged
xudong963 merged 1 commit into
apache:branch-50from
alamb:alamb/backport_regression_fix
Sep 13, 2025
Merged

[branch-50] fix: Implement AggregateUDFImpl::reverse_expr for StringAgg (#17165) (#17473)#17544
xudong963 merged 1 commit into
apache:branch-50from
alamb:alamb/backport_regression_fix

Conversation

@alamb

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

We fixed a bug found in testing DataFusion 50, so let's backport the change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

* Add failing test
* Fix regression in SELECT FROM syntax with WHERE clause
When using 'SELECT FROM table WHERE condition', the query should create
an empty projection (no columns) while still filtering rows. This was
broken by PR apache#17295 which added FROM-first syntax support.
The issue was that both 'FROM table' and 'SELECT FROM table' resulted
in empty projection lists, making them indistinguishable. The fix checks
for the presence of a WHERE clause to differentiate:
- 'FROM table' (no WHERE) -> add wildcard projection (all columns)
- 'SELECT FROM table WHERE ...' -> keep empty projection
Also updates the test expectation to correctly show the empty Projection
node in the query plan.
Fixesapache#17513
* Revert
* Fix regression: SELECT FROM syntax should return empty projection
Removes automatic wildcard projection for empty projections, fixing
the regression where `SELECT FROM table` incorrectly returned all
columns instead of empty projection.
Note: This temporarily breaks FROM-first syntax. A proper fix would
require distinguishing between `FROM table` and `SELECT FROM table`
at the parser level.
Fixesapache#17513
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* add a better regression test
* remove comment
* fmt
* Update datafusion/sqllogictest/test_files/projection.slt
Co-authored-by: Oleks V <comphead@users.noreply.github.com>
* Update datafusion/core/tests/sql/select.rs
Co-authored-by: Oleks V <comphead@users.noreply.github.com>
* revert docs
* fmt
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Oleks V <comphead@users.noreply.github.com>
@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation sql SQL Planner core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) labels Sep 12, 2025
@xudong963
xudong963 merged commit 10343c1 into apache:branch-50Sep 13, 2025
29 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coreCore DataFusion cratedocumentationImprovements or additions to documentationsqlSQL PlannersqllogictestSQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@alamb@adriangb@xudong963