-
Notifications
You must be signed in to change notification settings - Fork 29.2k
[SPARK-22712][SQL] Use buildReaderWithPartitionValues in native OrcFileFormat
#19907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -124,7 +124,7 @@ class OrcFileFormat | |
| true | ||
| } | ||
|
|
||
| override def buildReader( | ||
| override def buildReaderWithPartitionValues( | ||
| sparkSession: SparkSession, | ||
| dataSchema: StructType, | ||
| partitionSchema: StructType, | ||
|
|
@@ -138,6 +138,8 @@ class OrcFileFormat | |
| } | ||
| } | ||
|
|
||
| val resultSchema = StructType(requiredSchema.fields ++ partitionSchema.fields) | ||
|
|
||
| val broadcastedConf = | ||
| sparkSession.sparkContext.broadcast(new SerializableConfiguration(hadoopConf)) | ||
| val isCaseSensitive = sparkSession.sessionState.conf.caseSensitiveAnalysis | ||
|
|
@@ -167,8 +169,10 @@ class OrcFileFormat | |
| val iter = new RecordReaderIterator[OrcStruct](orcRecordReader) | ||
| Option(TaskContext.get()).foreach(_.addTaskCompletionListener(_ => iter.close())) | ||
|
|
||
| val unsafeProjection = UnsafeProjection.create(requiredSchema) | ||
| val deserializer = new OrcDeserializer(dataSchema, requiredSchema, requestedColIds) | ||
| val colIds = requestedColIds ++ List.fill(partitionSchema.length)(-1).toArray[Int] | ||
| val unsafeProjection = UnsafeProjection.create(resultSchema) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we follow parquet and just join the data row and partition row, and do a final unsafe projection? It's much easier and there is no performance difference.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Parquet Vectorization work like the following.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I see. you meant non-vectorized path. Sorry, I was confused since I focused too much on vectorized path. I'll do. |
||
| val deserializer = | ||
| new OrcDeserializer(dataSchema, resultSchema, colIds, file.partitionValues) | ||
| iter.map(value => unsafeProjection(deserializer.deserialize(value))) | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @cloud-fan . During the previous ORC PR, we left this behind.