Github user bogdanrdc commented on a diff in the pull request:
https://github.com/apache/spark/pull/16608#discussion_r96323081
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/GenerateExec.scala ---
@@ -160,9 +160,20 @@ case class GenerateExec(
// Generate looping variables.
val index = ctx.freshName("index")
+ val numElements = ctx.freshName("numElements")
+
+ // In case of outer=true we need to make sure the loop is executed
at-least once when the
+ // array/map contains no input.
+ // generateOuter is an int. it is set to 1 iff outer is true and the
input is empty or null.
+ val generateOuter = ctx.freshName("generateOuter")
+ val isOuter = if (outer) {
--- End diff --
I simplified it by using index == -1 like you said and reverting to the old
code. It was also easy to make it produce (null, null) for posexplode_outer
instead of (-1, null). @rxin preferred to return null and not -1 (or even 0)
for the position. So now, everything is null always.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]