-
Notifications
You must be signed in to change notification settings - Fork 28.1k
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
[SPARK-23760][SQL] CodegenContext.withSubExprEliminationExprs should save/restore CSE state correctly #20870
Conversation
… it saves/restores CSE state correctly.
8635969
to
df45286
Compare
@@ -942,7 +940,7 @@ class CodegenContext { | |||
def subexpressionEliminationForWholeStageCodegen(expressions: Seq[Expression]): SubExprCodes = { | |||
// Create a clear EquivalentExpressions and SubExprEliminationState mapping | |||
val equivalentExpressions: EquivalentExpressions = new EquivalentExpressions | |||
val subExprEliminationExprs = mutable.HashMap.empty[Expression, SubExprEliminationState] | |||
val localSubExprEliminationExprs = mutable.HashMap.empty[Expression, SubExprEliminationState] |
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.
This renaming isn't necessary for the fix per-se, but I'd like to piggyback it on this change so that it's clearer that we're not interfering with the current CSE state of this CodegenContext here.
Test build #88448 has finished for PR 20870 at commit
|
Test build #88449 has finished for PR 20870 at commit
|
jenkins retest this please |
Test build #88459 has finished for PR 20870 at commit
|
good catch! merging to master/2.3! also cc @viirya |
…save/restore CSE state correctly ## What changes were proposed in this pull request? Fixed `CodegenContext.withSubExprEliminationExprs()` so that it saves/restores CSE state correctly. ## How was this patch tested? Added new unit test to verify that the old CSE state is indeed saved and restored around the `withSubExprEliminationExprs()` call. Manually verified that this test fails without this patch. Author: Kris Mok <kris.mok@databricks.com> Closes #20870 from rednaxelafx/codegen-subexpr-fix. (cherry picked from commit 95e51ff) Signed-off-by: Wenchen Fan <wenchen@databricks.com>
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.
Late LGTM! Thanks for fixing this!
…save/restore CSE state correctly ## What changes were proposed in this pull request? Fixed `CodegenContext.withSubExprEliminationExprs()` so that it saves/restores CSE state correctly. ## How was this patch tested? Added new unit test to verify that the old CSE state is indeed saved and restored around the `withSubExprEliminationExprs()` call. Manually verified that this test fails without this patch. Author: Kris Mok <kris.mok@databricks.com> Closes apache#20870 from rednaxelafx/codegen-subexpr-fix. (cherry picked from commit 95e51ff) Signed-off-by: Wenchen Fan <wenchen@databricks.com>
What changes were proposed in this pull request?
Fixed
CodegenContext.withSubExprEliminationExprs()
so that it saves/restores CSE state correctly.How was this patch tested?
Added new unit test to verify that the old CSE state is indeed saved and restored around the
withSubExprEliminationExprs()
call. Manually verified that this test fails without this patch.