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

[SPARK-23760][SQL] CodegenContext.withSubExprEliminationExprs should save/restore CSE state correctly #20870

Closed
wants to merge 1 commit into from

Conversation

rednaxelafx
Copy link
Contributor

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.

@rednaxelafx rednaxelafx changed the title [SPARK-23760][SQL]: CodegenContext.withSubExprEliminationExprs should save/restore CSE state correctly [SPARK-23760][SQL] CodegenContext.withSubExprEliminationExprs should save/restore CSE state correctly Mar 21, 2018
@@ -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]
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 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.

@SparkQA
Copy link

SparkQA commented Mar 21, 2018

Test build #88448 has finished for PR 20870 at commit 8635969.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Mar 21, 2018

Test build #88449 has finished for PR 20870 at commit df45286.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@rednaxelafx
Copy link
Contributor Author

jenkins retest this please

@SparkQA
Copy link

SparkQA commented Mar 21, 2018

Test build #88459 has finished for PR 20870 at commit df45286.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@cloud-fan
Copy link
Contributor

good catch! merging to master/2.3!

also cc @viirya

asfgit pushed a commit that referenced this pull request Mar 22, 2018
…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>
@asfgit asfgit closed this in 95e51ff Mar 22, 2018
Copy link
Member

@viirya viirya left a 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!

peter-toth pushed a commit to peter-toth/spark that referenced this pull request Oct 6, 2018
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants