Github user liancheng commented on a diff in the pull request:
https://github.com/apache/spark/pull/5196#discussion_r27191279
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/complexTypes.scala
---
@@ -142,3 +142,29 @@ case class CreateArray(children: Seq[Expression])
extends Expression {
override def toString: String = s"Array(${children.mkString(",")})"
}
+
+/**
+ * Returns a Row containing the evaluation of all children expressions.
+ */
+case class CreateStruct(children: Seq[Expression]) extends Expression {
+ override type EvaluatedType = Row
+
+ override def foldable: Boolean = children.forall(_.foldable)
+
+ override lazy val resolved: Boolean = childrenResolved
+
+ override def dataType: StructType = {
+ assert(resolved, s"CreateStruct is called with unresolved children:
$children.")
--- End diff --
The error message is confusing. `CreateStruct` *can* be called with
unresolved children (and you actually did this [here] [1]), but
`CreateStruct.dataType` can't, because child types may be unknown.
[1]:
https://github.com/apache/spark/pull/5196/files#diff-9c84e1d27f25714e256cb482069359cfR52
---
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]