Skip to content

Conversation

@cloud-fan
Copy link
Contributor

What changes were proposed in this pull request?

SampleExec has a bug that it sets needCopyResult to false as long as the withReplacement parameter is false. This causes problems if its child needs to copy the result, e.g. a join.

Why are the changes needed?

to fix a correctness issue

Does this PR introduce any user-facing change?

Yes, the result will be corrected.

How was this patch tested?

a new test

@cloud-fan cloud-fan added the SQL label Nov 4, 2019
@cloud-fan
Copy link
Contributor Author

cloud-fan commented Nov 4, 2019

cc @viirya @maropu @hvanhovell


override def needCopyResult: Boolean = withReplacement
override def needCopyResult: Boolean = {
child.asInstanceOf[CodegenSupport].needCopyResult || withReplacement
Copy link
Member

Choose a reason for hiding this comment

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

Good catch!

Copy link
Member

Choose a reason for hiding this comment

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

Oh, yes. Indeed.

@gatorsmile
Copy link
Member

This bug fix needs to be backported to all the active versions.

@dongjoon-hyun dongjoon-hyun changed the title [SPARK-29743] sample should set needCopyResult to true if its child is [SPARK-29743][SQL] sample should set needCopyResult to true if its child is Nov 4, 2019
Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

+1, LGTM. Thank you so much, @cloud-fan !

@dongjoon-hyun
Copy link
Member

I tested the new UT locally, but this PR might break some other sample UTs in PySpark/SparkR. Let's see the Jenkins result.

@SparkQA
Copy link

SparkQA commented Nov 4, 2019

Test build #113212 has finished for PR 26387 at commit 09b3abe.

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

@dongjoon-hyun
Copy link
Member

Merged to master/2.4. Thank you, @cloud-fan , @viirya , @gatorsmile .

dongjoon-hyun pushed a commit that referenced this pull request Nov 4, 2019
…ild is

`SampleExec` has a bug that it sets `needCopyResult` to false as long as the `withReplacement` parameter is false. This causes problems if its child needs to copy the result, e.g. a join.

to fix a correctness issue

Yes, the result will be corrected.

a new test

Closes #26387 from cloud-fan/sample-bug.

Authored-by: Wenchen Fan <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit 326b789)
Signed-off-by: Dongjoon Hyun <[email protected]>
@maropu
Copy link
Member

maropu commented Nov 4, 2019

oh.. I'm late. LGTM. Anyway, good catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants