Skip to content

Conversation

@kiszk
Copy link
Member

@kiszk kiszk commented Nov 18, 2017

What changes were proposed in this pull request?

This PR changes concat_ws code generation to place generated code for expression for arguments into separated methods if these size could be large.
This PR resolved the case of concat_ws with a lot of argument

How was this patch tested?

Added new test cases into StringExpressionsSuite

@SparkQA
Copy link

SparkQA commented Nov 18, 2017

Test build #83978 has finished for PR 19777 at commit 1714c88.

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

val varargNum = ctx.freshName("varargNum")
ctx.addMutableState("int", varargNum, "")
val idxInVararg = ctx.freshName("idxInVararg")
ctx.addMutableState("int", idxInVararg, "")
Copy link
Contributor

@cloud-fan cloud-fan Nov 20, 2017

Choose a reason for hiding this comment

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

can we do better? I think we can avoid these global variables.

Copy link
Member Author

@kiszk kiszk Nov 20, 2017

Choose a reason for hiding this comment

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

Sure, you are right. Let me do it later.

"""
},
_.mkString(s"$varargNum += ", s";\n$varargNum += ", ";"))
val varargBuilds = ctx.splitExpressions(varargBuild, "varargBuildsConcatWs",
Copy link
Contributor

Choose a reason for hiding this comment

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

shall we optimize for eval.isNull == "true" in varargCount and varargBuild? since you already did it for the all string cases.

@SparkQA
Copy link

SparkQA commented Nov 20, 2017

Test build #84030 has finished for PR 19777 at commit 2a15b33.

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

@SparkQA
Copy link

SparkQA commented Nov 20, 2017

Test build #84034 has finished for PR 19777 at commit 7344fa4.

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

asfgit pushed a commit that referenced this pull request Nov 21, 2017
## What changes were proposed in this pull request?

This PR changes `concat_ws` code generation to place generated code for expression for arguments into separated methods if these size could be large.
This PR resolved the case of `concat_ws` with a lot of argument

## How was this patch tested?

Added new test cases into `StringExpressionsSuite`

Author: Kazuaki Ishizaki <[email protected]>

Closes #19777 from kiszk/SPARK-22549.

(cherry picked from commit 41c6f36)
Signed-off-by: Wenchen Fan <[email protected]>
@cloud-fan
Copy link
Contributor

thanks, merging to master/2.2!

@asfgit asfgit closed this in 41c6f36 Nov 21, 2017
MatthewRBruce pushed a commit to Shopify/spark that referenced this pull request Jul 31, 2018
## What changes were proposed in this pull request?

This PR changes `concat_ws` code generation to place generated code for expression for arguments into separated methods if these size could be large.
This PR resolved the case of `concat_ws` with a lot of argument

## How was this patch tested?

Added new test cases into `StringExpressionsSuite`

Author: Kazuaki Ishizaki <[email protected]>

Closes apache#19777 from kiszk/SPARK-22549.

(cherry picked from commit 41c6f36)
Signed-off-by: Wenchen Fan <[email protected]>
val args = ctx.freshName("args")

val inputs = strings.zipWithIndex.map { case (eval, index) =>
if (eval.isNull != "true") {
Copy link
Member

Choose a reason for hiding this comment

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

@kiszk I was looking at build warnings and it notes that this compares a ExprValue and String and they will always not be equal. Should it be eval.isNull.code != "true" maybe?

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