Skip to content

Conversation

@satanson
Copy link
Contributor

@satanson satanson commented Sep 29, 2025

Why I'm doing:

Array functions constant folding is absent, for an example: array_contains(['A', 'B'], NULL) can be reduced to false. so array-type predicates fail to push down left join, for an exmple:

select t0.* from t0 left join t1 on t0.a  = t1.a where array_contains(['A', 'B'], t1.b);

since array_contains(['A', 'B'], NULL) can be evaluated to false, thus left join can be transformed into inner join.

What I'm doing:

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 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.0
    • 3.5
    • 3.4
    • 3.3

@satanson satanson requested a review from a team as a code owner September 29, 2025 07:48
@satanson satanson force-pushed the array_function_constant_folding branch from dd9a2a3 to a1a65bf Compare September 30, 2025 03:17
LiShuMing
LiShuMing previously approved these changes Oct 9, 2025
@satanson satanson force-pushed the array_function_constant_folding branch 2 times, most recently from 932e1bd to e949270 Compare October 10, 2025 09:16
@satanson satanson force-pushed the array_function_constant_folding branch from e949270 to c3cf219 Compare October 11, 2025 01:53
@sonarqubecloud
Copy link

@github-actions
Copy link

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

@github-actions
Copy link

[FE Incremental Coverage Report]

pass : 168 / 173 (97.11%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/sql/optimizer/rewrite/scalar/FoldConstantsRule.java 167 172 97.09% [94, 148, 187, 239, 419]
🔵 com/starrocks/sql/optimizer/rewrite/ScalarOperatorFunctions.java 1 1 100.00% []

@github-actions
Copy link

[BE Incremental Coverage Report]

pass : 0 / 0 (0%)

@satanson satanson merged commit 674145d into main Oct 11, 2025
62 checks passed
@satanson satanson deleted the array_function_constant_folding branch October 11, 2025 06:22
satanson added a commit that referenced this pull request Oct 15, 2025
satanson added a commit that referenced this pull request Oct 15, 2025
satanson added a commit that referenced this pull request Oct 16, 2025
satanson added a commit that referenced this pull request Oct 16, 2025
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.

5 participants