Skip to content
Closed
Show file tree
Hide file tree
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 @@ -20,7 +20,6 @@ package org.apache.spark.sql.catalyst.expressions.codegen
import scala.collection.mutable

import org.apache.spark.sql.catalyst.expressions._
import org.apache.spark.sql.types.DataType

/**
* Defines util methods used in expression code generation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ case class BroadcastHashJoinExec(
| $value = ${ev.value};
|}
""".stripMargin
ExprCode(code, isNull, value)
ExprCode(code, isNull, value, inputRow = matched)
Copy link
Contributor

Choose a reason for hiding this comment

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

we need to check more places that create ExprCode outside of Expression.genCode and see if we set the inputs correctly.

Copy link
Member Author

Choose a reason for hiding this comment

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

ya, I'll look around.

Copy link
Member Author

Choose a reason for hiding this comment

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

I checked if the files below have the same issue though, I didn't found it (double-checks needed);

./catalyst/expressions/codegen/CodeGenerator.scala:202:    ExprCode(code, "false", value)
./catalyst/expressions/codegen/ExpressionCodegen.scala:89:      ExprCode(code = "", value = state.value, isNull = state.isNull)
./catalyst/expressions/codegen/GenerateMutableProjection.scala:90:        val ev = ExprCode("", s"isNull_$i", s"value_$i")
./catalyst/expressions/codegen/GenerateSafeProjection.scala:77:    ExprCode(code, "false", output)
./catalyst/expressions/codegen/GenerateSafeProjection.scala:107:    ExprCode(code, "false", output)
./catalyst/expressions/codegen/GenerateSafeProjection.scala:128:    ExprCode(code, "false", output)
./catalyst/expressions/codegen/GenerateSafeProjection.scala:140:    case _ => ExprCode("", "false", input)
./catalyst/expressions/codegen/GenerateUnsafeProjection.scala:55:      ExprCode("", s"$tmpInput.isNullAt($i)", ctx.getValue(tmpInput, dt, i.toString))
./catalyst/expressions/codegen/GenerateUnsafeProjection.scala:353:    ExprCode(code, "false", result)
./catalyst/expressions/complexTypeCreator.scala:397:    ExprCode(code = eval.code, isNull = "false", value = eval.value)
./catalyst/expressions/datetimeExpressions.scala:677:          ExprCode("", "true", ctx.defaultValue(dataType))
./catalyst/expressions/datetimeExpressions.scala:812:        ExprCode("", "true", "(UTF8String) null")
./catalyst/expressions/Expression.scala:103:      ExprCode(ctx.registerComment(this.toString), subExprState.isNull, subExprState.value)
./catalyst/expressions/Expression.scala:107:      val eval = doGenCode(ctx, ExprCode("", isNull, value))
./catalyst/expressions/misc.scala:85:    ExprCode(code = s"""${eval.code}
./catalyst/expressions/nullExpressions.scala:325:    ExprCode(code = eval.code, isNull = "false", value = eval.isNull)
./catalyst/expressions/nullExpressions.scala:351:    ExprCode(code = eval.code, isNull = "false", value = s"(!(${eval.isNull}))")
./catalyst/expressions/objects/objects.scala:448:    ExprCode(code = "", value = value, isNull = if (nullable) isNull else "false")
./execution/aggregate/HashAggregateExec.scala:200:      ExprCode(ev.code + initVars, isNull, value)
./execution/aggregate/HashMapGenerator.scala:59:      ExprCode(ev.code + initVars, isNull, value)
./execution/basicPhysicalOperators.scala:372:    val ev = ExprCode("", "false", value)
./execution/ColumnarBatchScan.scala:62:    ExprCode(code, isNullVar, valueVar)
./execution/ExpandExec.scala:159:        ExprCode(code, isNull, value)
./execution/GenerateExec.scala:172:        Seq(ExprCode("", s"$index == -1", index))
./execution/GenerateExec.scala:174:        Seq(ExprCode("", "false", index))
./execution/GenerateExec.scala:317:      ExprCode(code, isNull, value)
./execution/GenerateExec.scala:319:      ExprCode(s"$javaType $value = $getter;", "false", value)
./execution/joins/BroadcastHashJoinExec.scala:195:        ExprCode(code, isNull, value, inputRow = matched)
./execution/joins/BroadcastHashJoinExec.scala:490:    val resultVar = input ++ Seq(ExprCode("", "false", existsVar))
./execution/joins/SortMergeJoinExec.scala:535:        (ExprCode(code, isNull, value), leftVarsDecl)
./execution/joins/SortMergeJoinExec.scala:539:        (ExprCode(code, "false", value), leftVarsDecl)
./execution/WholeStageCodegenExec.scala:130:      ExprCode("", "false", row)
./execution/WholeStageCodegenExec.scala:145:        ExprCode(code, "false", ev.value)
./execution/WholeStageCodegenExec.scala:148:        ExprCode("", "false", "unsafeRow")

Copy link
Member

Choose a reason for hiding this comment

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

Except for L195, BroadcastHashJoinExec is safe.

Copy link
Member

Choose a reason for hiding this comment

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

I've double-checked the above list. I think they are safe.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks!

}
}
}
Expand Down