viirya commented on a change in pull request #28681:
URL: https://github.com/apache/spark/pull/28681#discussion_r432990384



##########
File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ObjectExpressionsSuite.scala
##########
@@ -202,6 +203,20 @@ class ObjectExpressionsSuite extends SparkFunSuite with 
ExpressionEvalHelper {
       Invoke(funcSubObj, "binOp", DoubleType, inputSum), 0.75, 
InternalRow.apply(1, 0.25))
   }
 
+  test("SPARK-31854: Invoke in MapElementsExec should not propagate null") {
+    val targetObject = new InvokeTargetClass
+    val funcClass = classOf[InvokeTargetClass]
+    val funcObj = Literal.create(targetObject, ObjectType(funcClass))
+    val inputInt = Seq(BoundReference(0, ObjectType(classOf[Any]), true))
+    val outputType = ObjectType(classOf[(Any, Any)])
+    val inputRow = 
InternalRow.fromSeq(Seq(null.asInstanceOf[java.lang.Integer]))
+    val createExpr = (propagateNull: Boolean) => {
+      Invoke(funcObj, "mapFunc", outputType, inputInt, propagateNull)
+    }
+    checkObjectExprEvaluation(createExpr(true), null, inputRow)
+    checkObjectExprEvaluation(createExpr(false), (null, null), inputRow)
+  }
+

Review comment:
       I think this test is already passed before this change, right?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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

Reply via email to