ulysses-you commented on a change in pull request #30868:
URL: https://github.com/apache/spark/pull/30868#discussion_r547022162
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/LiteralExpressionSuite.scala
##########
@@ -326,4 +326,15 @@ class LiteralExpressionSuite extends SparkFunSuite with
ExpressionEvalHelper {
assert(literalStr === expected)
}
}
+
+ test("SPARK-33860: Make CatalystTypeConverters.convertToCatalyst match
special Array value") {
+ assert(Literal(Array(1, 2, 3)) == Literal.create(Array(1, 2, 3),
ArrayType(IntegerType)))
+ assert(Literal(Array(1L, 2L, 3L)) == Literal.create(Array(1L, 2L, 3L),
ArrayType(LongType)))
+ assert(Literal(Array(1D, 2D, 3D)) == Literal.create(Array(1D, 2D, 3D),
ArrayType(DoubleType)))
+ assert(Literal("123") == Literal.create(Array('1', '2', '3'), StringType))
+ assert(Literal(Array(1.toByte, 2.toByte, 3.toByte)) ==
+ Literal.create(Array(1.toByte, 2.toByte, 3.toByte), BinaryType))
+ assert(Literal(Array("1", "2", "3")) ==
+ Literal.create(Array("1", "2", "3"), ArrayType(StringType)))
Review comment:
I think it's not a user-facing bug. User usually use the `Literal.apply`
code path and the `Literal.create` is used by Spark self.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]