Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/13971#discussion_r69008018
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/generators.scala
---
@@ -141,11 +148,33 @@ case class Explode(child: Expression) extends
UnaryExpression with Generator wit
val rows = new Array[InternalRow](inputMap.numElements())
var i = 0
inputMap.foreach(kt, vt, (k, v) => {
- rows(i) = InternalRow(k, v)
+ rows(i) = if (position) InternalRow(i, k, v) else
InternalRow(k, v)
i += 1
})
rows
}
}
}
}
+
+/**
+ * Given an input array produces a sequence of rows for each value in the
array.
+ */
+// scalastyle:off line.size.limit
+@ExpressionDescription(
+ usage = "_FUNC_(a) - Separates the elements of array a into multiple
rows, or the elements of map a into multiple rows and columns.")
+// scalastyle:on line.size.limit
+case class Explode(child: Expression)
+ extends ExplodeBase(child, position = false) with Serializable {
+}
+
+/**
+ * Given an input array produces a sequence of rows for each position and
value in the array.
--- End diff --
btw since the expression description might be difficult to see without line
wrapping, it'd also be better to put an example here.
---
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]