forked from apache/datafusion-comet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add experimental support for Apache Spark 3.5.1 (apache#587)
* add profile * fix for LegacyBehaviorPolicy * fix 3.5 ShimCometScanExec * builds with Spark 3.5 * fix builds * use correct parquet version * make docs more explicit * bug fix * remove use of reflection * fix * fix 4.0 build * allow different stability plans for 3.5 * copy approved plans from 3.x to 3.5 * regenerate golden files for 3.5 * enable CI test * fix merge conflict * remove unused imports * Refine shim * remove some uses of reflection * refine shim * remove unused code * remove unused imports * add isTimestampNTZType to 3.5 shim * address feedback * remove unused imports * address feedback
- Loading branch information
Showing
287 changed files
with
58,341 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
common/src/main/spark-3.4/org/apache/comet/shims/ShimBatchReader.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.apache.comet.shims | ||
|
||
import org.apache.spark.paths.SparkPath | ||
import org.apache.spark.sql.catalyst.InternalRow | ||
import org.apache.spark.sql.execution.datasources.PartitionedFile | ||
|
||
object ShimBatchReader { | ||
|
||
def newPartitionedFile(partitionValues: InternalRow, file: String): PartitionedFile = | ||
PartitionedFile( | ||
partitionValues, | ||
SparkPath.fromPathString(file), | ||
-1, // -1 means we read the entire file | ||
-1, | ||
Array.empty[String], | ||
0, | ||
0) | ||
} |
38 changes: 38 additions & 0 deletions
38
common/src/main/spark-3.5/org/apache/comet/shims/ShimBatchReader.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.apache.comet.shims | ||
|
||
import org.apache.spark.paths.SparkPath | ||
import org.apache.spark.sql.catalyst.InternalRow | ||
import org.apache.spark.sql.execution.datasources.PartitionedFile | ||
|
||
object ShimBatchReader { | ||
|
||
def newPartitionedFile(partitionValues: InternalRow, file: String): PartitionedFile = | ||
PartitionedFile( | ||
partitionValues, | ||
SparkPath.fromPathString(file), | ||
-1, // -1 means we read the entire file | ||
-1, | ||
Array.empty[String], | ||
0, | ||
0, | ||
Map.empty) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
spark/src/main/spark-3.5/org/apache/comet/shims/CometExprShim.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.comet.shims | ||
|
||
import org.apache.comet.expressions.CometEvalMode | ||
import org.apache.spark.sql.catalyst.expressions._ | ||
import org.apache.spark.sql.types.{DataType, TimestampNTZType} | ||
|
||
/** | ||
* `CometExprShim` acts as a shim for for parsing expressions from different Spark versions. | ||
*/ | ||
trait CometExprShim { | ||
/** | ||
* Returns a tuple of expressions for the `unhex` function. | ||
*/ | ||
protected def unhexSerde(unhex: Unhex): (Expression, Expression) = { | ||
(unhex.child, Literal(unhex.failOnError)) | ||
} | ||
|
||
protected def isTimestampNTZType(dt: DataType): Boolean = dt match { | ||
case _: TimestampNTZType => true | ||
case _ => false | ||
} | ||
|
||
protected def evalMode(c: Cast): CometEvalMode.Value = | ||
CometEvalModeUtil.fromSparkEvalMode(c.evalMode) | ||
} | ||
|
||
object CometEvalModeUtil { | ||
def fromSparkEvalMode(evalMode: EvalMode.Value): CometEvalMode.Value = evalMode match { | ||
case EvalMode.LEGACY => CometEvalMode.LEGACY | ||
case EvalMode.TRY => CometEvalMode.TRY | ||
case EvalMode.ANSI => CometEvalMode.ANSI | ||
} | ||
} | ||
|
36 changes: 36 additions & 0 deletions
36
spark/src/main/spark-3.5/org/apache/comet/shims/ShimSQLConf.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.apache.comet.shims | ||
|
||
import org.apache.spark.sql.internal.LegacyBehaviorPolicy | ||
import org.apache.spark.sql.internal.SQLConf | ||
|
||
trait ShimSQLConf { | ||
|
||
/** | ||
* Spark 3.4 renamed parquetFilterPushDownStringStartWith to | ||
* parquetFilterPushDownStringPredicate | ||
*/ | ||
protected def getPushDownStringPredicate(sqlConf: SQLConf): Boolean = | ||
sqlConf.parquetFilterPushDownStringPredicate | ||
|
||
protected val LEGACY = LegacyBehaviorPolicy.LEGACY | ||
protected val CORRECTED = LegacyBehaviorPolicy.CORRECTED | ||
} |
Oops, something went wrong.