Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Commit

Permalink
[NSE-979] fix data source (#993)
Browse files Browse the repository at this point in the history
* fix data source

Signed-off-by: Yuan Zhou <[email protected]>

* fix

Signed-off-by: Yuan Zhou <[email protected]>

* Fix ut issue

Co-authored-by: philo <[email protected]>
  • Loading branch information
zhouyuan and PHILO-HE authored Jun 27, 2022
1 parent b28ec12 commit 84511b5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class ArrowFileFormat extends FileFormat with DataSourceRegister with Serializab
// todo predicate validation / pushdown
val parquetFileFields = factory.inspect().getFields.asScala
val caseInsensitiveFieldMap = mutable.Map[String, String]()
val requiredFields = if (sqlConf.caseSensitiveAnalysis) {
val requiredFields = if (caseSensitive) {
new Schema(requiredSchema.map { field =>
parquetFileFields.find(_.getName.equals(field.name))
.getOrElse(ArrowUtils.toArrowField(field))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ case class ArrowPartitionReaderFactory(

private val batchSize = sqlConf.parquetVectorizedReaderBatchSize
private val enableFilterPushDown: Boolean = sqlConf.arrowFilterPushDown
private val caseSensitive: Boolean = sqlConf.caseSensitiveAnalysis

override def supportColumnarReads(partition: InputPartition): Boolean = true

Expand All @@ -63,7 +64,7 @@ case class ArrowPartitionReaderFactory(
partitionedFile.start, partitionedFile.length, options)
val parquetFileFields = factory.inspect().getFields.asScala
val caseInsensitiveFieldMap = mutable.Map[String, String]()
val requiredFields = if (sqlConf.caseSensitiveAnalysis) {
val requiredFields = if (caseSensitive) {
new Schema(readDataSchema.map { field =>
parquetFileFields.find(_.getName.equals(field.name))
.getOrElse(ArrowUtils.toArrowField(field))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ class ArrowDataSourceTest extends QueryTest with SharedSparkSession {
"id"
}
val df = spark.read
.schema(s"$selectColName long")
.arrow(tempPath.getPath)
.filter(s"$selectColName <= 2")
checkAnswer(df, Row(0) :: Row(1) :: Row(2) :: Nil)
Expand Down

0 comments on commit 84511b5

Please sign in to comment.