AngersZhuuuu commented on a change in pull request #30421:
URL: https://github.com/apache/spark/pull/30421#discussion_r585551155
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/SQLInsertTestSuite.scala
##########
@@ -209,6 +211,52 @@ trait SQLInsertTestSuite extends QueryTest with
SQLTestUtils {
}
}
+ test("SPARK-33474: Support typed literals as partition spec values") {
+ withTable("t1") {
+ val binaryStr = "Spark SQL"
+ val binaryHexStr =
Hex.hex(UTF8String.fromString(binaryStr).getBytes).toString
+ sql(
+ """
+ | CREATE TABLE t1(name STRING, part1 DATE, part2 TIMESTAMP, part3
BINARY,
+ | part4 STRING, part5 STRING, part6 STRING, part7 STRING)
+ | USING PARQUET PARTITIONED BY (part1, part2, part3, part4, part5,
part6, part7)
+ """.stripMargin)
+
+ sql(
+ s"""
+ | INSERT OVERWRITE t1 PARTITION(
+ | part1 = date'2019-01-01',
+ | part2 = timestamp'2019-01-01 11:11:11',
+ | part3 = X'$binaryHexStr',
+ | part4 = 'p1',
+ | part5 = date'2019-01-01',
+ | part6 = timestamp'2019-01-01 11:11:11',
+ | part7 = X'$binaryHexStr'
+ | ) VALUES('a')
+ """.stripMargin)
+ checkAnswer(sql(
+ """
+ | SELECT
+ | name,
+ | CAST(part1 AS STRING),
+ | CAST(part2 as STRING),
+ | CAST(part3 as STRING),
+ | CAST(part4 as STRING),
Review comment:
Done
----------------------------------------------------------------
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]