-
Notifications
You must be signed in to change notification settings - Fork 435
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2b8e7a4
commit bb08d4c
Showing
8 changed files
with
241 additions
and
57 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
42 changes: 42 additions & 0 deletions
42
gluten-core/src/main/scala/io/glutenproject/execution/DataSourceV2TransformerRegister.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,42 @@ | ||
/* | ||
* 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 io.glutenproject.execution | ||
|
||
import org.apache.spark.sql.catalyst.expressions.Expression | ||
import org.apache.spark.sql.execution.datasources.v2.BatchScanExec | ||
|
||
/** | ||
* Data sources v2 transformer should implement this trait so that they can register an alias to | ||
* their data source v2 transformer. This allows users to give the data source v2 transformer alias | ||
* as the format type over the fully qualified class name. | ||
*/ | ||
trait DataSourceV2TransformerRegister { | ||
|
||
/** | ||
* The string that represents the format that this data source v2 transformer provider uses. This | ||
* is overridden by children to provide a nice alias for the data source. For example: | ||
* | ||
* {{{ | ||
* override def shortName(): String = "iceberg" | ||
* }}} | ||
*/ | ||
def scanClassName(): String | ||
|
||
def createDataSourceV2Transformer( | ||
batchScan: BatchScanExec, | ||
partitionFilters: Seq[Expression]): BatchScanExecTransformer | ||
} |
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
1 change: 1 addition & 0 deletions
1
...in/resources/META-INF/services/io.glutenproject.execution.DataSourceV2TransformerRegister
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 @@ | ||
io.glutenproject.execution.IcebergTransformerProvider |
31 changes: 31 additions & 0 deletions
31
gluten-iceberg/src/main/scala/io/glutenproject/execution/IcebergTransformerProvider.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,31 @@ | ||
/* | ||
* 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 io.glutenproject.execution | ||
|
||
import org.apache.spark.sql.catalyst.expressions.Expression | ||
import org.apache.spark.sql.execution.datasources.v2.BatchScanExec | ||
|
||
class IcebergTransformerProvider extends DataSourceV2TransformerRegister { | ||
|
||
override def scanClassName(): String = "org.apache.iceberg.spark.source.SparkBatchQueryScan" | ||
|
||
override def createDataSourceV2Transformer( | ||
batchScan: BatchScanExec, | ||
partitionFilters: Seq[Expression]): BatchScanExecTransformer = { | ||
IcebergScanTransformer.apply(batchScan, partitionFilters) | ||
} | ||
} |
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
56 changes: 56 additions & 0 deletions
56
gluten-iceberg/src/test/scala/io/glutenproject/execution/VeloxIcebergSuite.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,56 @@ | ||
/* | ||
* 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 io.glutenproject.execution | ||
|
||
import org.apache.spark.SparkConf | ||
|
||
class VeloxIcebergSuite extends WholeStageTransformerSuite { | ||
|
||
protected val rootPath: String = getClass.getResource("/").getPath | ||
override protected val backend: String = "velox" | ||
override protected val resourcePath: String = "/tpch-data-parquet-velox" | ||
override protected val fileFormat: String = "parquet" | ||
|
||
override protected def sparkConf: SparkConf = { | ||
super.sparkConf | ||
.set("spark.shuffle.manager", "org.apache.spark.shuffle.sort.ColumnarShuffleManager") | ||
.set("spark.sql.files.maxPartitionBytes", "1g") | ||
.set("spark.sql.shuffle.partitions", "1") | ||
.set("spark.memory.offHeap.size", "2g") | ||
.set("spark.unsafe.exceptionOnMemoryLeak", "true") | ||
.set("spark.sql.autoBroadcastJoinThreshold", "-1") | ||
.set( | ||
"spark.sql.extensions", | ||
"org.apache.iceberg.spark.extensions.IcebergSparkSessionExtensions") | ||
.set("spark.sql.catalog.spark_catalog", "org.apache.iceberg.spark.SparkCatalog") | ||
.set("spark.sql.catalog.spark_catalog.type", "hadoop") | ||
.set("spark.sql.catalog.spark_catalog.warehouse", s"file://$rootPath/tpch-data-iceberg-velox") | ||
} | ||
|
||
test("iceberg transformer exists") { | ||
spark.sql(""" | ||
|create table iceberg_tb using iceberg as | ||
|(select 1 as col1, 2 as col2, 3 as col3) | ||
|""".stripMargin) | ||
|
||
runQueryAndCompare(""" | ||
|select * from iceberg_tb; | ||
|""".stripMargin) { | ||
checkOperatorMatch[IcebergScanTransformer] | ||
} | ||
} | ||
} |
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