cloud-fan commented on a change in pull request #32335:
URL: https://github.com/apache/spark/pull/32335#discussion_r619972665
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/BaseScriptTransformationSuite.scala
##########
@@ -599,6 +602,37 @@ abstract class BaseScriptTransformationSuite extends
SparkPlanTest with SQLTestU
'e.cast("string")).collect())
}
}
+
+ test("SPARK-35220: DayTimeIntervalType/YearMonthIntervalType show different
" +
+ "between hive serde and row format delimited\t") {
+ assume(TestUtils.testCommandAvailable("/bin/bash"))
+ withTempView("v") {
+ val df = Seq(
+ (Duration.ofDays(1), Period.ofMonths(10))
+ ).toDF("a", "b")
+ df.createTempView("v")
+
+ if (defaultSerDe == "hive-serde") {
+ checkAnswer(sql(
+ """
+ |SELECT TRANSFORM(a, b)
+ | USING 'cat' AS (a, b)
+ |FROM v
+ |""".stripMargin),
+ identity,
+ Row("1 00:00:00.000000000", "0-10") :: Nil)
+ } else {
+ checkAnswer(sql(
+ """
+ |SELECT TRANSFORM(a, b)
+ | USING 'cat' AS (a, b)
+ |FROM v
+ |""".stripMargin),
+ identity,
+ Row("INTERVAL '1 00:00:00' DAY TO SECOND", "INTERVAL '0-10' YEAR TO
MONTH") :: Nil)
Review comment:
so the spark-sql shell and `df.show` have different formats for
intervals?
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/BaseScriptTransformationSuite.scala
##########
@@ -599,6 +602,37 @@ abstract class BaseScriptTransformationSuite extends
SparkPlanTest with SQLTestU
'e.cast("string")).collect())
}
}
+
+ test("SPARK-35220: DayTimeIntervalType/YearMonthIntervalType show different
" +
+ "between hive serde and row format delimited\t") {
+ assume(TestUtils.testCommandAvailable("/bin/bash"))
+ withTempView("v") {
+ val df = Seq(
+ (Duration.ofDays(1), Period.ofMonths(10))
+ ).toDF("a", "b")
+ df.createTempView("v")
+
+ if (defaultSerDe == "hive-serde") {
+ checkAnswer(sql(
+ """
+ |SELECT TRANSFORM(a, b)
+ | USING 'cat' AS (a, b)
+ |FROM v
+ |""".stripMargin),
+ identity,
+ Row("1 00:00:00.000000000", "0-10") :: Nil)
+ } else {
+ checkAnswer(sql(
+ """
+ |SELECT TRANSFORM(a, b)
+ | USING 'cat' AS (a, b)
+ |FROM v
+ |""".stripMargin),
+ identity,
+ Row("INTERVAL '1 00:00:00' DAY TO SECOND", "INTERVAL '0-10' YEAR TO
MONTH") :: Nil)
Review comment:
Is interval format the only difference between hive format and spark
cast?
--
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]