Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,10 @@ class CodegenContext extends Logging {
}

val codes = if (commonExprVals.map(_.code.length).sum > SQLConf.get.methodSplitThreshold) {
if (commonExprs.map(calculateParamLength).forall(isValidParamLength)) {
val inputVarsForAllFuncs = commonExprs.map { expr =>
getLocalInputVariableValues(this, expr.head).toSeq
}
if (inputVarsForAllFuncs.map(calculateParamLengthFromExprValues).forall(isValidParamLength)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

@viirya @cloud-fan sorry, but I found my mistake made in SPARK-29008... Could you check?

Copy link
Member

Choose a reason for hiding this comment

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

yea, good catch! We should check param length for input parameters to common expressions.

commonExprs.zipWithIndex.map { case (exprs, i) =>
val expr = exprs.head
val eval = commonExprVals(i)
Expand All @@ -1068,7 +1071,7 @@ class CodegenContext extends Logging {

// Generate the code for this expression tree and wrap it in a function.
val fnName = freshName("subExpr")
val inputVars = getLocalInputVariableValues(this, expr).toSeq
val inputVars = inputVarsForAllFuncs(i)
val argList = inputVars.map(v => s"${v.javaType.getName} ${v.variableName}")
val returnType = javaType(expr.dataType)
val fn =
Expand Down