Skip to content

[SPARK-12288] [SQL] Support UnsafeRow in Coalesce/Except/Intersect. #10285

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
wants to merge 4 commits into from

Conversation

gatorsmile
Copy link
Member

Support UnsafeRow for the Coalesce/Except/Intersect.

Could you review if my code changes are ok? @davies Thank you!

@SparkQA
Copy link

SparkQA commented Dec 14, 2015

Test build #47633 has finished for PR 10285 at commit cbb2c59.

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

@@ -263,6 +265,10 @@ case class Except(left: SparkPlan, right: SparkPlan) extends BinaryNode {
protected override def doExecute(): RDD[InternalRow] = {
left.execute().map(_.copy()).subtract(right.execute().map(_.copy()))
}

override def outputsUnsafeRows: Boolean = children.forall(_.outputsUnsafeRows)
Copy link
Contributor

Choose a reason for hiding this comment

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

If an operator's children produce both unsafe and safe rows, we will convert everything unsafe rows.
so here should be children.exists(_.outputsUnsafeRows)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you! I also found the same issue exists in Union I also did a correction.

@SparkQA
Copy link

SparkQA commented Dec 14, 2015

Test build #47674 has finished for PR 10285 at commit b17ba61.

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

@gatorsmile
Copy link
Member Author

The failed test case is not related to my change. I will try to see if I can fix the flaky R test.

@gatorsmile
Copy link
Member Author

retest this please

@SparkQA
Copy link

SparkQA commented Dec 15, 2015

Test build #47687 has finished for PR 10285 at commit b17ba61.

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

val preparedPlan = sqlContext.prepareForExecution.execute(plan)
assert(getConverters(preparedPlan).size === 1)
assert(preparedPlan.outputsUnsafeRows)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

should we add mixed rows test for coalesce too?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, I am not sure if I understand your question. Coalesce only has a single child. I am not sure what mixed rows mean. Could you give me one example? Thank you! @cloud-fan

Copy link
Contributor

Choose a reason for hiding this comment

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

oh sorry, I thought it was org.apache.spark.sql.catalyst.expressions.Coalesce, nvm

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you!

@SparkQA
Copy link

SparkQA commented Dec 15, 2015

Test build #47698 has finished for PR 10285 at commit b3b70af.

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

@davies
Copy link
Contributor

davies commented Dec 15, 2015

LGTM, merging into master, thanks!

@asfgit asfgit closed this in 606f99b Dec 15, 2015
@gatorsmile gatorsmile deleted the unsafeSupportCIE branch August 6, 2016 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants