Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19733#discussion_r150440568
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala
 ---
    @@ -236,24 +236,30 @@ case class In(value: Expression, list: 
Seq[Expression]) extends Predicate {
       override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = {
         val valueGen = value.genCode(ctx)
         val listGen = list.map(_.genCode(ctx))
    +    ctx.addMutableState("boolean", ev.value, "")
    +    ctx.addMutableState("boolean", ev.isNull, "")
    +    val valueArg = ctx.freshName("valueArg")
         val listCode = listGen.map(x =>
           s"""
             if (!${ev.value}) {
               ${x.code}
               if (${x.isNull}) {
                 ${ev.isNull} = true;
    -          } else if (${ctx.genEqual(value.dataType, valueGen.value, 
x.value)}) {
    +          } else if (${ctx.genEqual(value.dataType, valueArg, x.value)}) {
                 ${ev.isNull} = false;
                 ${ev.value} = true;
               }
             }
    -       """).mkString("\n")
    +       """)
    +    val args = ("InternalRow", ctx.INPUT_ROW) :: 
(ctx.javaType(value.dataType), valueArg) :: Nil
    +    val listCodes = ctx.splitExpressions(listCode, "apply", args)
    --- End diff --
    
    This overloading `splitExpressions` doesn't have the guard against the case 
`ctx.INPUT_ROW == null`. Split expressions will fail in that case.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to