Skip to content

Commit 562a43b

Browse files
committed
Support Spark 4.2 CatalogTable constructor in HiveTableCatalog
Spark 4.2.0 added a 22nd parameter multipartIdentifier: Option[Seq[String]] to CatalogTable (SPARK-52729), so the reflective newCatalogTable could not find a matching constructor and every createTable/insert path failed with NoSuchMethodException. Add a leading reflective branch for the 22-argument constructor, falling back to the 4.0 (21-arg) and 3.5 (20-arg) signatures.
1 parent 871db15 commit 562a43b

1 file changed

Lines changed: 52 additions & 1 deletion

File tree

  • extensions/spark/kyuubi-spark-connector-hive/src/main/scala/org/apache/kyuubi/spark/connector/hive

extensions/spark/kyuubi-spark-connector-hive/src/main/scala/org/apache/kyuubi/spark/connector/hive/HiveTableCatalog.scala

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,58 @@ class HiveTableCatalog(sparkSession: SparkSession)
203203
ignoredProperties: Map[String, String] = Map.empty,
204204
viewOriginalText: Option[String] = None): CatalogTable = {
205205
// scalastyle:on
206-
Try { // SPARK-50675 (4.0.0)
206+
Try { // SPARK-52729 (4.2.0)
207+
DynConstructors.builder()
208+
.impl(
209+
classOf[CatalogTable],
210+
classOf[TableIdentifier],
211+
classOf[CatalogTableType],
212+
classOf[CatalogStorageFormat],
213+
classOf[StructType],
214+
classOf[Option[String]],
215+
classOf[Seq[String]],
216+
classOf[Option[BucketSpec]],
217+
classOf[String],
218+
classOf[Long],
219+
classOf[Long],
220+
classOf[String],
221+
classOf[Map[String, String]],
222+
classOf[Option[CatalogStatistics]],
223+
classOf[Option[String]],
224+
classOf[Option[String]],
225+
classOf[Option[String]],
226+
classOf[Seq[String]],
227+
classOf[Boolean],
228+
classOf[Boolean],
229+
classOf[Map[String, String]],
230+
classOf[Option[String]],
231+
classOf[Option[Seq[String]]])
232+
.buildChecked()
233+
.invokeChecked[CatalogTable](
234+
null,
235+
identifier,
236+
tableType,
237+
storage,
238+
schema,
239+
provider,
240+
partitionColumnNames,
241+
bucketSpec,
242+
owner,
243+
createTime,
244+
lastAccessTime,
245+
createVersion,
246+
properties,
247+
stats,
248+
viewText,
249+
comment,
250+
collation,
251+
unsupportedFeatures,
252+
tracksPartitionsInCatalog,
253+
schemaPreservesCase,
254+
ignoredProperties,
255+
viewOriginalText,
256+
None)
257+
}.recover { case _: Exception => // SPARK-50675 (4.0.0)
207258
DynConstructors.builder()
208259
.impl(
209260
classOf[CatalogTable],

0 commit comments

Comments
 (0)