Skip to content

[BugFix] Prevent aggregate pushdown when group keys involve JSON type#68142

Merged
stephen-shelby merged 1 commit intoStarRocks:mainfrom
stephen-shelby:fix_json_push_agg
Jan 21, 2026
Merged

[BugFix] Prevent aggregate pushdown when group keys involve JSON type#68142
stephen-shelby merged 1 commit intoStarRocks:mainfrom
stephen-shelby:fix_json_push_agg

Conversation

@stephen-shelby
Copy link
Contributor

@stephen-shelby stephen-shelby commented Jan 20, 2026

Why I'm doing:

Aggregate pushdown may rewrite DISTINCT/group-by expressions to their used columns when pushing below Project/Join.
For expressions that depend on a JSON column, this can end up pushing down an aggregate that groups by a JSON column, which is not supported in BE and fails at runtime with:
group by type JSON is not supported backend.

What I'm doing:

  • Add a safety check in PushDownAggregateCollector to block aggregate pushdown when any group-key used column type cannot be grouped in BE (e.g. JSON).

Fixes #issue

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
    • This pr needs auto generate documentation
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 4.1
    • 4.0
    • 3.5
    • 3.4

@stephen-shelby stephen-shelby requested a review from a team as a code owner January 20, 2026 03:49
@stephen-shelby stephen-shelby changed the title [BugFix] Prevent aggregate pushdown when group keys involve JSON type [UT] Prevent aggregate pushdown when group keys involve JSON type Jan 20, 2026
@StarRocks-Reviewer
Copy link

@cursor review

@stephen-shelby stephen-shelby changed the title [UT] Prevent aggregate pushdown when group keys involve JSON type [BugFix] Prevent aggregate pushdown when group keys involve JSON type Jan 20, 2026
@sonarqubecloud
Copy link

@github-actions
Copy link
Contributor

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

@github-actions
Copy link
Contributor

[BE Incremental Coverage Report]

pass : 0 / 0 (0%)

@github-actions
Copy link
Contributor

[FE Incremental Coverage Report]

pass : 4 / 4 (100.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/sql/optimizer/rule/tree/pdagg/PushDownAggregateCollector.java 4 4 100.00% []

@stephen-shelby stephen-shelby merged commit 8e40076 into StarRocks:main Jan 21, 2026
101 of 113 checks passed
@github-actions
Copy link
Contributor

@Mergifyio backport branch-3.5

@github-actions
Copy link
Contributor

@Mergifyio backport branch-4.0

@github-actions
Copy link
Contributor

@Mergifyio backport branch-4.1

@mergify
Copy link
Contributor

mergify bot commented Jan 21, 2026

backport branch-3.5

✅ Backports have been created

Details

@mergify
Copy link
Contributor

mergify bot commented Jan 21, 2026

backport branch-4.0

✅ Backports have been created

Details

@mergify
Copy link
Contributor

mergify bot commented Jan 21, 2026

backport branch-4.1

✅ Backports have been created

Details

mergify bot pushed a commit that referenced this pull request Jan 21, 2026
…#68142)

Signed-off-by: stephen <stephen5217@163.com>
(cherry picked from commit 8e40076)
mergify bot pushed a commit that referenced this pull request Jan 21, 2026
…#68142)

Signed-off-by: stephen <stephen5217@163.com>
(cherry picked from commit 8e40076)
mergify bot pushed a commit that referenced this pull request Jan 21, 2026
…#68142)

Signed-off-by: stephen <stephen5217@163.com>
(cherry picked from commit 8e40076)
wanpengfei-git pushed a commit that referenced this pull request Jan 21, 2026
… (backport #68142) (#68197)

Signed-off-by: stephen <stephen5217@163.com>
Co-authored-by: stephen <91597003+stephen-shelby@users.noreply.github.com>
wanpengfei-git pushed a commit that referenced this pull request Jan 21, 2026
… (backport #68142) (#68198)

Signed-off-by: stephen <stephen5217@163.com>
Co-authored-by: stephen <91597003+stephen-shelby@users.noreply.github.com>
wanpengfei-git pushed a commit that referenced this pull request Jan 22, 2026
… (backport #68142) (#68196)

Signed-off-by: stephen <stephen5217@163.com>
Co-authored-by: stephen <91597003+stephen-shelby@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants