From df0809644955da2c448607bb1cef613ae01e557f Mon Sep 17 00:00:00 2001 From: Yaniv Kunda Date: Wed, 26 Mar 2025 11:55:59 +0200 Subject: [PATCH 1/4] added fallback using reflection for backward-compatibility --- .github/workflows/spark_sql_test.yml | 2 +- .../sql/comet/shims/ShimCometScanExec.scala | 39 +++++++++++++++++-- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/.github/workflows/spark_sql_test.yml b/.github/workflows/spark_sql_test.yml index a752531a50..f3a4c7576b 100644 --- a/.github/workflows/spark_sql_test.yml +++ b/.github/workflows/spark_sql_test.yml @@ -45,7 +45,7 @@ jobs: matrix: os: [ubuntu-24.04] java-version: [11] - spark-version: [{short: '3.4', full: '3.4.3'}, {short: '3.5', full: '3.5.5'}] + spark-version: [{short: '3.4', full: '3.4.3'}, {short: '3.5', full: '3.5.4'}, {short: '3.5', full: '3.5.5'}] module: - {name: "catalyst", args1: "catalyst/test", args2: ""} - {name: "sql/core-1", args1: "", args2: sql/testOnly * -- -l org.apache.spark.tags.ExtendedSQLTest -l org.apache.spark.tags.SlowSQLTest} diff --git a/spark/src/main/spark-3.5/org/apache/spark/sql/comet/shims/ShimCometScanExec.scala b/spark/src/main/spark-3.5/org/apache/spark/sql/comet/shims/ShimCometScanExec.scala index 684953e2db..87622f6f51 100644 --- a/spark/src/main/spark-3.5/org/apache/spark/sql/comet/shims/ShimCometScanExec.scala +++ b/spark/src/main/spark-3.5/org/apache/spark/sql/comet/shims/ShimCometScanExec.scala @@ -55,15 +55,48 @@ trait ShimCometScanExec { protected def isNeededForSchema(sparkSchema: StructType): Boolean = false protected def getPartitionedFile(f: FileStatusWithMetadata, p: PartitionDirectory): PartitionedFile = - PartitionedFileUtil.getPartitionedFile(f, f.getPath, p.values) + try { + PartitionedFileUtil.getPartitionedFile(f, f.getPath, p.values) + } catch { + case _: NoSuchMethodError => + // Fallback using reflection without the Path parameter for backward-compatability + // See https://github.com/apache/datafusion-comet/issues/1572 + PartitionedFileUtil.getClass.getMethod("getPartitionedFile", + classOf[FileStatusWithMetadata], + classOf[InternalRow] + ).invoke(PartitionedFileUtil, + f, + p.values + ).asInstanceOf[PartitionedFile] + } protected def splitFiles(sparkSession: SparkSession, file: FileStatusWithMetadata, filePath: Path, isSplitable: Boolean, maxSplitBytes: Long, - partitionValues: InternalRow): Seq[PartitionedFile] = - PartitionedFileUtil.splitFiles(sparkSession, file, filePath, isSplitable, maxSplitBytes, partitionValues) + partitionValues: InternalRow): Seq[PartitionedFile] = { + try { + PartitionedFileUtil.splitFiles(sparkSession, file, filePath, isSplitable, maxSplitBytes, partitionValues) + } catch { + case _: NoSuchMethodError => + // Fallback using reflection without the Path parameter for backward-compatability + // See https://github.com/apache/datafusion-comet/issues/1572 + PartitionedFileUtil.getClass.getMethod("splitFiles", + classOf[SparkSession], + classOf[FileStatusWithMetadata], + java.lang.Boolean.TYPE, + java.lang.Long.TYPE, + classOf[InternalRow] + ).invoke(PartitionedFileUtil, + sparkSession, + file, + java.lang.Boolean.valueOf(isSplitable), + java.lang.Long.valueOf(maxSplitBytes), + partitionValues + ).asInstanceOf[Seq[PartitionedFile]] + } + } protected def getPushedDownFilters(relation: HadoopFsRelation , dataFilters: Seq[Expression]): Seq[Filter] = { val supportNestedPredicatePushdown = DataSourceUtils.supportNestedPredicatePushdown(relation) From e5f041271c01ea45d7451485262c4e6e012041bd Mon Sep 17 00:00:00 2001 From: Yaniv Kunda Date: Wed, 26 Mar 2025 13:52:01 +0200 Subject: [PATCH 2/4] restored 3.5.4.diff file for backward-compatibility testing --- dev/diffs/3.5.4.diff | 3034 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 3034 insertions(+) create mode 100644 dev/diffs/3.5.4.diff diff --git a/dev/diffs/3.5.4.diff b/dev/diffs/3.5.4.diff new file mode 100644 index 0000000000..47bc3ccd0b --- /dev/null +++ b/dev/diffs/3.5.4.diff @@ -0,0 +1,3034 @@ +diff --git a/pom.xml b/pom.xml +index 8dc47f391f9..8a3e72133a8 100644 +--- a/pom.xml ++++ b/pom.xml +@@ -152,6 +152,8 @@ + --> + 2.5.1 + 2.0.8 ++ 3.5 ++ 0.7.0-SNAPSHOT +