Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement]optimize subfield expr evaluate when copy is no need #35585

Merged
merged 1 commit into from
Nov 30, 2023

Conversation

zombee0
Copy link
Contributor

@zombee0 zombee0 commented Nov 22, 2023

Why I'm doing:
subfield expr of struct evaluate cost a lot because of memory copy.

What I'm doing:
Don't copy when copy is no need for subfiled expr.

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

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.2
    • 3.1
    • 3.0
    • 2.5

@zombee0 zombee0 requested review from a team as code owners November 22, 2023 08:00
@zombee0 zombee0 force-pushed the optimize_subfiled branch 4 times, most recently from e8533e4 to 34f5ae1 Compare November 23, 2023 06:31
Signed-off-by: zombee0 <ewang2027@gmail.com>
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

0.0% 0.0% Coverage
0.0% 0.0% Duplication

warning The version of Java (11.0.21) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more here

Copy link

[FE Incremental Coverage Report]

pass : 52 / 56 (92.86%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/qe/SessionVariable.java 2 4 50.00% [2691, 2692]
🔵 com/starrocks/analysis/SubfieldExpr.java 6 8 75.00% [65, 120]
🔵 com/starrocks/sql/optimizer/Optimizer.java 2 2 100.00% []
🔵 com/starrocks/sql/optimizer/operator/scalar/SubfieldOperator.java 11 11 100.00% []
🔵 com/starrocks/catalog/ColumnAccessPath.java 5 5 100.00% []
🔵 com/starrocks/sql/optimizer/rule/RuleType.java 1 1 100.00% []
🔵 com/starrocks/sql/plan/ScalarOperatorToExpr.java 1 1 100.00% []
🔵 com/starrocks/sql/optimizer/rule/tree/prunesubfield/SubfieldExprNoCopyRule.java 24 24 100.00% []

Copy link

[BE Incremental Coverage Report]

fail : 5 / 7 (71.43%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 src/exprs/subfield_expr.cpp 5 7 71.43% [30, 87]

for (int i = 0; i < projectMapValues.size(); i++) {
ScalarOperator value = projectMapValues.get(i);
// only deal with subfield expr of slotRef
if (value instanceof SubfieldOperator && value.getChild(0) instanceof ColumnRefOperator) {
Copy link
Contributor

@Seaven Seaven Nov 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think don't need the condition?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is used to simplify the case

gensrc/thrift/Exprs.thrift Show resolved Hide resolved
@Youngwb Youngwb merged commit e54d15d into StarRocks:main Nov 30, 2023
51 of 53 checks passed
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