harshmotw-db commented on code in PR #47907:
URL: https://github.com/apache/spark/pull/47907#discussion_r1736712462
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/variant/variantExpressions.scala:
##########
@@ -114,6 +114,85 @@ case class IsVariantNull(child: Expression) extends
UnaryExpression
copy(child = newChild)
}
+// scalastyle:off line.size.limit
+@ExpressionDescription(
+ usage = "_FUNC_(expr) - Convert a nested input (array/map/struct) into a
variant where maps and structs are converted to variant objects which are
unordered unlike SQL structs. Input maps can only have string keys.",
Review Comment:
Yes and no. From a logical perspective, the keys should be thought of as
random and the users should not assume anything about the order.
However, in the spec, [the field IDs are sorted based on the lexicographic
order of the
keys](https://github.com/apache/spark/blob/dad2b763f004a72613276b31738a958e80d02b37/common/variant/README.md?plain=1#L373).
This is to make it possible to binary search for the required key.
--
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]