Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/19901#discussion_r155383877
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala
---
@@ -237,37 +237,41 @@ case class In(value: Expression, list:
Seq[Expression]) extends Predicate {
val javaDataType = ctx.javaType(value.dataType)
val valueGen = value.genCode(ctx)
val listGen = list.map(_.genCode(ctx))
- ctx.addMutableState(ctx.JAVA_BOOLEAN, ev.value)
- ctx.addMutableState(ctx.JAVA_BOOLEAN, ev.isNull)
+ // inTmpResult has 3 possible values:
+ // -1 means no matches found and there is at least one value in the
list evaluated to null
+ // 0 means no matches found and all values in the list are not null
+ // 1 means one value in the list is matched
--- End diff --
Could we define some constants with meaningful names in `doGenCode`?
```Scala
// -1 means no matches found and there is at least one value in the list
evaluated
final val HAS_NULL = -1
// 0 means no matches found and all values in the list are not null
final val NOT_MATCHED = 0
// 1 means one value in the list is matched
final val MATCHED = 1
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]