-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-21870][SQL] Split aggregation code into small functions #20965
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
Closed
Closed
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
8a4fd61
Split aggregation into small functions
maropu c9901fc
Address reviews
maropu 88ff7d7
Give up splitting aggregate code if a parameter length goes over the …
maropu 860740b
Defines a split function for each aggregation expression
maropu 4a42e35
Makes splitAggregateFunc enabled by default for testing
maropu 3ede09d
Split aggregate code if the code length goes over the threshold
maropu 5cc844e
Address reviews
maropu 2100a2e
Drop unnecessary ones from input variables
maropu 511594a
Brush up tests
maropu 7ced128
Fix a test error
maropu ed7cf41
Address reviews
maropu df20f3e
Fix errors
maropu 649db0a
Fix a bug
maropu e7d40e3
Address comments
maropu e47b16f
Fix
maropu 8e3da46
Address reviews
maropu d1e06a6
Address comments
maropu 5088939
Fix style issue
maropu 20b310f
Trun off the split mode temporarily for Jenkins tests
maropu ab8de83
Revert "Trun off the split mode temporarily for Jenkins tests"
maropu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -354,12 +354,14 @@ case class IsNotNull(child: Expression) extends UnaryExpression with Predicate { | |
|
|
||
| override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = { | ||
| val eval = child.genCode(ctx) | ||
| val value = eval.isNull match { | ||
| case TrueLiteral => FalseLiteral | ||
| case FalseLiteral => TrueLiteral | ||
| case v => JavaCode.isNullExpression(s"!$v") | ||
| val (value, newCode) = eval.isNull match { | ||
| case TrueLiteral => (FalseLiteral, EmptyBlock) | ||
| case FalseLiteral => (TrueLiteral, EmptyBlock) | ||
| case v => | ||
| val value = ctx.freshName("value") | ||
| (JavaCode.variable(value, BooleanType), code"boolean $value = !$v;") | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A simple query to reproduce this issue is as follows (without both changes); |
||
| } | ||
| ExprCode(code = eval.code, isNull = FalseLiteral, value = value) | ||
| ExprCode(code = eval.code + newCode, isNull = FalseLiteral, value = value) | ||
| } | ||
|
|
||
| override def sql: String = s"(${child.sql} IS NOT NULL)" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: so the stack here is only used for implementing depth-first pre-order traversal of an expression tree in an iterative style instead of recursive style, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, right. I just followed the other similar logics.