Github user kiszk commented on a diff in the pull request:
https://github.com/apache/spark/pull/22315#discussion_r214542052
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala
---
@@ -1464,17 +1464,27 @@ case class ArrayContains(left: Expression, right:
Expression)
nullSafeCodeGen(ctx, ev, (arr, value) => {
val i = ctx.freshName("i")
val getValue = CodeGenerator.getValue(arr, right.dataType, i)
- s"""
- for (int $i = 0; $i < $arr.numElements(); $i ++) {
- if ($arr.isNullAt($i)) {
- ${ev.isNull} = true;
- } else if (${ctx.genEqual(right.dataType, value, getValue)}) {
- ${ev.isNull} = false;
- ${ev.value} = true;
- break;
- }
+ val checkAndSetIsNullCode = if (nullable) {
--- End diff --
Could you update this part based on [this
comment](https://github.com/apache/spark/pull/21103#discussion_r205999519)
instead of `if (...) { ... } else`?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]