This repository has been archived by the owner on Sep 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
backport recent commits to 1.5 branch (#1187)
* [NSE-1170] Set correct row number in batch scan w/ partition columns (#1172) * [NSE-1171] Throw RuntimeException when reading duplicate fields in case-insensitive mode (#1173) * throw exception if one more columns matched in case insensitive mode * add schema check in arrow v2 * bump h2/pgsql version (#1176) * bump h2/pgsql version Signed-off-by: Yuan Zhou <[email protected]> * ignore one failed test Signed-off-by: Yuan Zhou <[email protected]> Signed-off-by: Yuan Zhou <[email protected]> * [NSE-956] allow to write parquet with compression (#1014) This patch adds support for writing parquet with compression df.coalesce(1).write.format("arrow").option("parquet.compression","zstd").save(path) Signed-off-by: Yuan Zhou [email protected] * [NSE-1161] Support read-write parquet conversion to read-write arrow (#1162) * add ArrowConvertExtension * do not convert parquet fileformat while writing to partitioned/bucketed/sorted output * fix cache failed * care about write codec * disable convertor extension by default * add some comments * remove wrong compress type check (#1178) Since the compresssion has been supported in #1014 . The extra compression check in ArrowConvertorExtension can be remove now. * fix to use right arrow branch (#1179) fix to use right arrow branch Signed-off-by: Yuan Zhou <[email protected]> * [NSE-1171] Support merge parquet schema and read missing schema (#1175) * Support merge parquet schema and read missing schema * fix error * optimize null vectors * optimize code * optimize code * change code * add schema merge suite tests * add test for struct type * to use 1.5 branch arrow Signed-off-by: Yuan Zhou <[email protected]> Signed-off-by: Yuan Zhou <[email protected]> Signed-off-by: Yuan Zhou [email protected] Co-authored-by: Jacky Lee <[email protected]>
- Loading branch information
1 parent
68a5298
commit 9639322
Showing
14 changed files
with
465 additions
and
160 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
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
58 changes: 58 additions & 0 deletions
58
...w-data-source/standard/src/main/scala/com/intel/oap/spark/sql/ArrowConvertExtension.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,58 @@ | ||
/* | ||
* 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 com.intel.oap.spark.sql | ||
|
||
import java.util.Locale | ||
|
||
import com.intel.oap.spark.sql.execution.datasources.arrow.ArrowFileFormat | ||
import org.apache.parquet.hadoop.ParquetOutputFormat | ||
|
||
import org.apache.spark.sql.{SparkSession, SparkSessionExtensions} | ||
import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan | ||
import org.apache.spark.sql.catalyst.rules.Rule | ||
import org.apache.spark.sql.execution.command.InsertIntoDataSourceDirCommand | ||
import org.apache.spark.sql.execution.datasources.{HadoopFsRelation, InsertIntoHadoopFsRelationCommand, LogicalRelation} | ||
import org.apache.spark.sql.execution.datasources.parquet.ParquetFileFormat | ||
|
||
class ArrowConvertorExtension extends (SparkSessionExtensions => Unit) { | ||
def apply(e: SparkSessionExtensions): Unit = { | ||
e.injectPostHocResolutionRule(session => ArrowConvertorRule(session)) | ||
} | ||
} | ||
|
||
case class ArrowConvertorRule(session: SparkSession) extends Rule[LogicalPlan] { | ||
override def apply(plan: LogicalPlan): LogicalPlan = { | ||
plan resolveOperators { | ||
// Write datasource path | ||
// TODO: support writing with partitioned/bucketed/sorted column | ||
case c: InsertIntoHadoopFsRelationCommand | ||
if c.fileFormat.isInstanceOf[ParquetFileFormat] && | ||
c.partitionColumns.isEmpty && c.bucketSpec.isEmpty => | ||
c.copy(fileFormat = new ArrowFileFormat) | ||
|
||
// Read path | ||
case l@ LogicalRelation( | ||
r@ HadoopFsRelation(_, _, _, _, _: ParquetFileFormat, _), _, _, _) => | ||
l.copy(relation = r.copy(fileFormat = new ArrowFileFormat)(session)) | ||
|
||
// INSERT DIR | ||
case c: InsertIntoDataSourceDirCommand if c.provider == "parquet" => | ||
c.copy(provider = "arrow") | ||
} | ||
} | ||
} |
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
Oops, something went wrong.