Skip to content

Commit 588efc7

Browse files
committed
[KYUUBI #7350] Make TPC-H/DS connector compatible with Spark 4.2
### Why are the changes needed? Adapt to SPARK-54870, which added a new arg to case class `CharType`/`VarCharType` ### How was this patch tested? We don't have Spark 4.2 CI coverage yet, so CI only ensures it won't breaking for older Spark versions. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #7350 from pan3793/tpc-spark-4.2. Closes #7350 b16d00f [Cheng Pan] TPC H/DS connector compatible with Spark 4.2 Authored-by: Cheng Pan <chengpan@apache.org> Signed-off-by: Cheng Pan <chengpan@apache.org>
1 parent 939e6e3 commit 588efc7

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

  • extensions/spark

extensions/spark/kyuubi-spark-connector-tpcds/src/main/scala/org/apache/kyuubi/spark/connector/tpcds/KyuubiTPCDSResults.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ class KyuubiResultsIterator(
144144
case (Some(v: Long), DateType) =>
145145
RebaseDateTime.rebaseJulianToGregorianDays(v.toInt) - DateTimeUtils.JULIAN_DAY_OF_EPOCH
146146
case (Some(v), StringType) => UTF8String.fromString(v.toString)
147-
case (Some(v), CharType(_)) => UTF8String.fromString(v.toString)
148-
case (Some(v), VarcharType(_)) => UTF8String.fromString(v.toString)
147+
case (Some(v), _: CharType) => UTF8String.fromString(v.toString)
148+
case (Some(v), _: VarcharType) => UTF8String.fromString(v.toString)
149149
case (Some(v: TPCDSDecimal), t: DecimalType) =>
150150
Decimal(v.getNumber, t.precision, t.scale)
151151
case (Some(v: Int), t: DecimalType) =>

extensions/spark/kyuubi-spark-connector-tpch/src/main/scala/org/apache/kyuubi/spark/connector/tpch/TPCHBatchScan.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ class TPCHPartitionReader(
135135
case (value, IntegerType) => rowAny += value.toInt
136136
case (value, LongType) => rowAny += value.toLong
137137
case (value, DoubleType) => rowAny += value.toDouble
138-
case (value, DateType) => rowAny += LocalDate.parse(formatDate(value.toInt), dateFmt)
139-
.toEpochDay.toInt
138+
case (value, DateType) =>
139+
rowAny += LocalDate.parse(formatDate(value.toInt), dateFmt).toEpochDay.toInt
140140
case (value, StringType) => rowAny += UTF8String.fromString(value)
141-
case (value, CharType(_)) => rowAny += UTF8String.fromString(value)
142-
case (value, VarcharType(_)) => rowAny += UTF8String.fromString(value)
141+
case (value, _: CharType) => rowAny += UTF8String.fromString(value)
142+
case (value, _: VarcharType) => rowAny += UTF8String.fromString(value)
143143
case (value, DecimalType()) => rowAny += Decimal(value)
144144
case (value, dt) => throw new IllegalArgumentException(s"value: $value, type: $dt")
145145
}

0 commit comments

Comments
 (0)