Skip to content

Commit 5a510cf

Browse files
AngersZhuuuuMaxGekk
andcommitted
[SPARK-35726][SPARK-35769][SQL][FOLLOWUP] Call periodToMonths and durationToMicros in HiveResult should add endField
### What changes were proposed in this pull request? When we call periodToMonths and durationToMicros with certain type field, we should pass endField parameter. ### Why are the changes needed? When we call periodToMonths and durationToMicros with certain type field, we should pass endField parameter. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Existed UT Closes apache#32984 from AngersZhuuuu/SPARK-35726-35769. Lead-authored-by: Angerszhuuuu <[email protected]> Co-authored-by: Maxim Gekk <[email protected]> Signed-off-by: Max Gekk <[email protected]>
1 parent 43cd6ca commit 5a510cf

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

sql/core/src/main/scala/org/apache/spark/sql/execution/HiveResult.scala

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,17 @@ object HiveResult {
119119
s""""${t.name}":${toHiveString((v, t.dataType), true, formatters)}"""
120120
}.mkString("{", ",", "}")
121121
case (period: Period, YearMonthIntervalType(startField, endField)) =>
122-
toYearMonthIntervalString(periodToMonths(period), HIVE_STYLE, startField, endField)
122+
toYearMonthIntervalString(
123+
periodToMonths(period, endField),
124+
HIVE_STYLE,
125+
startField,
126+
endField)
123127
case (duration: Duration, DayTimeIntervalType(startField, endField)) =>
124-
toDayTimeIntervalString(durationToMicros(duration), HIVE_STYLE, startField, endField)
128+
toDayTimeIntervalString(
129+
durationToMicros(duration, endField),
130+
HIVE_STYLE,
131+
startField,
132+
endField)
125133
case (other, _: UserDefinedType[_]) => other.toString
126134
}
127135
}

0 commit comments

Comments
 (0)