Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/19803#discussion_r152881282
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/BoundAttribute.scala
---
@@ -60,20 +60,23 @@ case class BoundReference(ordinal: Int, dataType:
DataType, nullable: Boolean)
override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = {
val javaType = ctx.javaType(dataType)
- val value = ctx.getValue(ctx.INPUT_ROW, dataType, ordinal.toString)
if (ctx.currentVars != null && ctx.currentVars(ordinal) != null) {
val oev = ctx.currentVars(ordinal)
ev.isNull = oev.isNull
ev.value = oev.value
- val code = oev.code
- oev.code = ""
- ev.copy(code = code)
- } else if (nullable) {
- ev.copy(code = s"""
- boolean ${ev.isNull} = ${ctx.INPUT_ROW}.isNullAt($ordinal);
- $javaType ${ev.value} = ${ev.isNull} ?
${ctx.defaultValue(dataType)} : ($value);""")
+ ev.copy(code = oev.code)
} else {
- ev.copy(code = s"""$javaType ${ev.value} = $value;""", isNull =
"false")
+ assert(ctx.INPUT_ROW != null)
--- End diff --
Add an assert message.
`assert(ctx.INPUT_ROW != null, "INPUT_ROW and currentVars cannot both be
null.")`
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]