rdblue commented on a change in pull request #828: iceberg-spark changes for
vectorized reads
URL: https://github.com/apache/incubator-iceberg/pull/828#discussion_r410528579
##########
File path: spark/src/main/java/org/apache/iceberg/spark/source/Reader.java
##########
@@ -238,6 +279,46 @@ public Statistics estimateStatistics() {
return new Stats(sizeInBytes, numRows);
}
+ @Override
+ public boolean enableBatchRead() {
+ return lazyCheckEnableBatchRead();
+ }
+
+ private boolean lazyCheckEnableBatchRead() {
+ if (enableBatchRead == null) {
+ boolean allParquetFileScanTasks =
+ tasks().stream()
+ .allMatch(combinedScanTask -> !combinedScanTask.isDataTask() &&
combinedScanTask.files()
+ .stream()
+ .allMatch(fileScanTask ->
fileScanTask.file().format().equals(
+ FileFormat.PARQUET)));
+ if (!allParquetFileScanTasks) {
+ this.enableBatchRead = false;
+ return false;
Review comment:
I think this method would be simpler by not exiting early. Something like
this:
```
if (enableBatchRead == null) {
boolean batchReadEnabled = ...;
boolean allParquetFileScanTasks = ...;
boolean atLeastOneColumn = lazySchema().columsn().size() > 0;
boolean hasNoIdentityProjections = ...;
enableBatchRead = batchReadEnabled && allParquetFileScanTasks &&
atLeastOneColumn && hasNoIdentityProjections;
}
return enableBatchRead;
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]