AngersZhuuuu commented on a change in pull request #33036:
URL: https://github.com/apache/spark/pull/33036#discussion_r656864694
##########
File path:
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveScriptTransformationSuite.scala
##########
@@ -522,36 +523,57 @@ class HiveScriptTransformationSuite extends
BaseScriptTransformationSuite with T
}
- test("SPARK-34879: HiveInspectors supports DayTimeIntervalType") {
+ test("SPARK-34879, SPARK-35733: HiveInspectors supports all type of
DayTimeIntervalType") {
assume(TestUtils.testCommandAvailable("/bin/bash"))
withTempView("v") {
- val df = Seq(
- (Duration.ofDays(1),
+ val schema = StructType(Seq(
+ StructField("a", DayTimeIntervalType(DAY)),
+ StructField("b", DayTimeIntervalType(DAY, HOUR)),
+ StructField("c", DayTimeIntervalType(DAY, MINUTE)),
+ StructField("d", DayTimeIntervalType(DAY, SECOND)),
+ StructField("e", DayTimeIntervalType(HOUR)),
+ StructField("f", DayTimeIntervalType(HOUR, MINUTE)),
+ StructField("g", DayTimeIntervalType(HOUR, SECOND)),
+ StructField("h", DayTimeIntervalType(MINUTE)),
+ StructField("i", DayTimeIntervalType(MINUTE, SECOND)),
+ StructField("j", DayTimeIntervalType(SECOND))
+ ))
+ val df = spark.createDataFrame(sparkContext.parallelize(Seq(
+ Row(Duration.ofDays(1),
+ Duration.ofHours(11),
+ Duration.ofMinutes(1),
Duration.ofSeconds(100).plusNanos(123456),
- Duration.of(Long.MaxValue, ChronoUnit.MICROS)),
- (Duration.ofDays(1),
- Duration.ofSeconds(100).plusNanos(1123456789),
- Duration.ofSeconds(Long.MaxValue /
DateTimeConstants.MICROS_PER_SECOND))
- ).toDF("a", "b", "c")
- df.createTempView("v")
+ Duration.of(Long.MaxValue, ChronoUnit.MICROS),
+ Duration.ofDays(1),
+ Duration.ofHours(11),
+ Duration.ofMinutes(1),
+ Duration.ofSeconds(100).plusNanos(123456),
+ Duration.ofSeconds(Long.MaxValue /
DateTimeConstants.MICROS_PER_SECOND)
+ ))), schema)
// Hive serde supports DayTimeIntervalType as input and output data type
checkAnswer(
df,
(child: SparkPlan) => createScriptTransformationExec(
script = "cat",
output = Seq(
- // TODO(SPARK-35733): Check all day-time interval types in
HiveInspectors tests
- AttributeReference("a", DayTimeIntervalType())(),
- AttributeReference("b", DayTimeIntervalType())(),
- AttributeReference("c", DayTimeIntervalType())()),
+ AttributeReference("a", DayTimeIntervalType(DAY))(),
+ AttributeReference("b", DayTimeIntervalType(DAY, HOUR))(),
+ AttributeReference("c", DayTimeIntervalType(DAY, MINUTE))(),
+ AttributeReference("d", DayTimeIntervalType(DAY, SECOND))(),
+ AttributeReference("e", DayTimeIntervalType(HOUR))(),
+ AttributeReference("f", DayTimeIntervalType(HOUR, MINUTE))(),
+ AttributeReference("g", DayTimeIntervalType(HOUR, SECOND))(),
+ AttributeReference("h", DayTimeIntervalType(MINUTE))(),
+ AttributeReference("i", DayTimeIntervalType(MINUTE, SECOND))(),
+ AttributeReference("j", DayTimeIntervalType(SECOND))()),
child = child,
ioschema = hiveIOSchema),
- df.select($"a", $"b", $"c").collect())
+ df.select($"a", $"b", $"c", $"d", $"e", $"f", $"g", $"h", $"i",
$"j").collect())
}
}
- test("SPARK-35722: HiveInspectors supports all type of
YearMonthIntervalType") {
+ test("SPARK-34879, SPARK-35722: HiveInspectors supports all type of
YearMonthIntervalType") {
Review comment:
@MaxGekk Also update here
--
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]