-
Notifications
You must be signed in to change notification settings - Fork 29.2k
[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
Changes from all commits
8a4fd61
c9901fc
88ff7d7
860740b
4a42e35
3ede09d
5cc844e
2100a2e
511594a
7ced128
ed7cf41
df20f3e
649db0a
e7d40e3
e47b16f
8e3da46
d1e06a6
5088939
20b310f
ab8de83
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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. This fix is related to https://github.com/apache/spark/pull/20965/files#diff-2eb948516b5beaeb746aadac27fbd5b4R287
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)" | ||
|
|
||
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.