cloud-fan commented on a change in pull request #32335:
URL: https://github.com/apache/spark/pull/32335#discussion_r620027850
##########
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:
Maybe we should have a new Expression `ToHiveString` and use it in
`df.show`, so that they are consistent.
##########
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:
Maybe we should have a new Expression `ToHiveString` and use it in
`df.show` and `TRANSFORM`, so that they are consistent.
--
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]