cloud-fan commented on a change in pull request #35352:
URL: https://github.com/apache/spark/pull/35352#discussion_r828656629



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala
##########
@@ -2095,7 +2095,9 @@ case class ArrayPosition(left: Expression, right: 
Expression)
 case class ElementAt(
     left: Expression,
     right: Expression,
-    failOnError: Boolean = SQLConf.get.ansiEnabled)
+    failOnError: Boolean = SQLConf.get.ansiEnabled,
+    // The value to return if index is out of bound
+    defaultValueOutOfBound: Any = null)

Review comment:
       I'm a little worried about this change, as it's tricky to support 
default value here. e.g. what if the element type is array/map/struct? what 
value we should put here? and how to use it in codegen?
   
   Instead, I think we need to use `Expression` to represent the default value, 
as this is the "language" catalyst speaks. This also means that the default 
value can be more than just literals




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to