Skip to content

Commit b895402

Browse files
chore: [FOLLOWUP] Drop support for Spark 3.3 (EOL) (apache#1534)
1 parent f51b51a commit b895402

File tree

55 files changed

+137
-870
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+137
-870
lines changed

common/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ under the License.
181181
<sources>
182182
<source>src/main/${shims.majorVerSrc}</source>
183183
<source>src/main/${shims.minorVerSrc}</source>
184-
<source>src/main/${shims.pre35Src}</source>
185184
</sources>
186185
</configuration>
187186
</execution>

common/src/main/java/org/apache/comet/parquet/ConstantColumnReader.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@
2323

2424
import org.apache.parquet.column.ColumnDescriptor;
2525
import org.apache.spark.sql.catalyst.InternalRow;
26+
import org.apache.spark.sql.catalyst.util.ResolveDefaultColumns;
2627
import org.apache.spark.sql.types.*;
2728
import org.apache.spark.unsafe.types.UTF8String;
2829

29-
import org.apache.comet.shims.ShimResolveDefaultColumns;
30-
3130
/**
3231
* A column reader that always return constant vectors. Used for reading partition columns, for
3332
* instance.
@@ -41,7 +40,9 @@ public class ConstantColumnReader extends MetadataColumnReader {
4140

4241
public ConstantColumnReader(StructField field, int batchSize, boolean useDecimal128) {
4342
this(field.dataType(), TypeUtil.convertToParquet(field), batchSize, useDecimal128);
44-
this.value = ShimResolveDefaultColumns.getExistenceDefaultValue(field);
43+
this.value =
44+
ResolveDefaultColumns.getExistenceDefaultValues(new StructType(new StructField[] {field}))[
45+
0];
4546
init(value);
4647
}
4748

common/src/main/scala/org/apache/spark/sql/comet/CastOverflowException.scala

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,17 @@
1919

2020
package org.apache.spark.sql.comet
2121

22-
import org.apache.spark.sql.comet.shims.ShimCastOverflowException
22+
import org.apache.spark.SparkArithmeticException
23+
import org.apache.spark.sql.errors.QueryExecutionErrors.toSQLConf
24+
import org.apache.spark.sql.internal.SQLConf
2325

2426
class CastOverflowException(t: String, from: String, to: String)
25-
extends ShimCastOverflowException(t, from, to) {}
27+
extends SparkArithmeticException(
28+
"CAST_OVERFLOW",
29+
Map(
30+
"value" -> t,
31+
"sourceType" -> s""""$from"""",
32+
"targetType" -> s""""$to"""",
33+
"ansiConfig" -> toSQLConf(SQLConf.ANSI_ENABLED.key)),
34+
Array.empty,
35+
"") {}

spark/src/main/spark-3.x/org/apache/comet/shims/ShimCometBatchScanExec.scala renamed to common/src/main/spark-3.4/org/apache/comet/shims/ShimFileFormat.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919

2020
package org.apache.comet.shims
2121

22-
import org.apache.spark.sql.catalyst.expressions.SortOrder
23-
import org.apache.spark.sql.execution.datasources.v2.BatchScanExec
22+
import org.apache.spark.sql.execution.datasources.{FileFormat, RowIndexUtil}
23+
import org.apache.spark.sql.types.StructType
2424

25-
trait ShimCometBatchScanExec {
26-
def wrapped: BatchScanExec
25+
object ShimFileFormat {
2726

28-
// Only for Spark 3.4+
29-
def ordering: Option[Seq[SortOrder]] = wrapped.getClass.getDeclaredMethods
30-
.filter(_.getName == "ordering")
31-
.flatMap(_.invoke(wrapped).asInstanceOf[Option[Seq[SortOrder]]])
32-
.headOption
27+
// A name for a temporary column that holds row indexes computed by the file format reader
28+
// until they can be placed in the _metadata struct.
29+
val ROW_INDEX_TEMPORARY_COLUMN_NAME: String = FileFormat.ROW_INDEX_TEMPORARY_COLUMN_NAME
30+
31+
def findRowIndexColumnIndexInSchema(sparkSchema: StructType): Int =
32+
RowIndexUtil.findRowIndexColumnIndexInSchema(sparkSchema)
3333
}

common/src/main/spark-3.4/org/apache/spark/sql/comet/shims/ShimCastOverflowException.scala

Lines changed: 0 additions & 37 deletions
This file was deleted.

spark/src/main/spark-3.x/org/apache/comet/shims/ShimCometTakeOrderedAndProjectExec.scala renamed to common/src/main/spark-3.5/org/apache/comet/shims/ShimFileFormat.scala

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,15 @@
1919

2020
package org.apache.comet.shims
2121

22-
import org.apache.spark.sql.execution.TakeOrderedAndProjectExec
22+
import org.apache.spark.sql.execution.datasources.parquet.ParquetFileFormat
23+
import org.apache.spark.sql.execution.datasources.parquet.ParquetRowIndexUtil
24+
import org.apache.spark.sql.types.StructType
2325

24-
trait ShimCometTakeOrderedAndProjectExec {
26+
object ShimFileFormat {
27+
// A name for a temporary column that holds row indexes computed by the file format reader
28+
// until they can be placed in the _metadata struct.
29+
val ROW_INDEX_TEMPORARY_COLUMN_NAME = ParquetFileFormat.ROW_INDEX_TEMPORARY_COLUMN_NAME
2530

26-
/**
27-
* TODO: delete after dropping Spark 3.3 support
28-
*/
29-
protected def getOffset(plan: TakeOrderedAndProjectExec): Option[Int] = {
30-
plan.getClass.getDeclaredFields
31-
.filter(_.getName == "offset")
32-
.map { a => a.setAccessible(true); a.get(plan).asInstanceOf[Int] }
33-
.headOption
34-
}
31+
def findRowIndexColumnIndexInSchema(sparkSchema: StructType): Int =
32+
ParquetRowIndexUtil.findRowIndexColumnIndexInSchema(sparkSchema)
3533
}

common/src/main/spark-3.5/org/apache/spark/sql/comet/shims/ShimCastOverflowException.scala

Lines changed: 0 additions & 37 deletions
This file was deleted.

common/src/main/spark-3.x/org/apache/comet/shims/ShimFileFormat.scala

Lines changed: 0 additions & 50 deletions
This file was deleted.

common/src/main/spark-3.x/org/apache/comet/shims/ShimResolveDefaultColumns.scala

Lines changed: 0 additions & 38 deletions
This file was deleted.

common/src/main/spark-4.0/org/apache/comet/shims/ShimResolveDefaultColumns.scala

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)