LuciferYang commented on code in PR #60706:
URL: https://github.com/apache/spark/pull/60706#discussion_r4625224584
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetRowConverter.scala:
##########
@@ -190,13 +190,16 @@ private[parquet] class ParquetRowConverter(
private[this] val currentRow = new
SpecificInternalRow(catalystType.map(_.dataType))
+ private[this] val existenceDefaultValues =
+ ResolveDefaultColumns.existenceDefaultValues(catalystType)
+
private[this] lazy val bitmask =
ResolveDefaultColumns.existenceDefaultsBitmask(catalystType)
/**
* The [[InternalRow]] converted from an entire Parquet record.
*/
def currentRecord: InternalRow = {
- applyExistenceDefaultValuesToRow(catalystType, currentRow, bitmask)
+ applyExistenceDefaultValuesToRow(existenceDefaultValues, currentRow,
bitmask)
Review Comment:
The description's clause "or when the query reads more than
`spark.sql.codegen.maxFields` (default: 100) fields" holds for ORC but not for
Parquet. For Parquet, `maxFields` only turns off columnar output; the
vectorized reader is still chosen by
`ParquetUtils.isBatchReadSupportedForSchema` alone
([ParquetFileFormat.scala#L263-L264](https://github.com/apache/spark/blob/d157ec95b9b/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetFileFormat.scala#L263-L264),
same in `ParquetPartitionReaderFactory`), so a wide scan gets rows from
`VectorizedParquetRecordReader` and never reaches
`ParquetRowConverter.currentRecord`. I built this PR's base and head and read a
Parquet table with 120 added `INT DEFAULT` columns: with the default config it
reads in under 100 ms on both, and only with the vectorized reader off does it
drop, from 2,138 ms to 27 ms. The same table in ORC drops from 2,147 ms to 33
ms with the default config.
Could you limit that clause to ORC? Otherwise the commit message tells
people with wide Parquet tables that this fix covers their default reads, which
go through the vectorized reader that #60702 changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]