abstractdog commented on code in PR #5195:
URL: https://github.com/apache/hive/pull/5195#discussion_r1615302602
##########
ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcInputFormat.java:
##########
@@ -1725,35 +1725,22 @@ private void populateAndCacheStripeDetails() throws
IOException {
}
private long computeProjectionSize(List<OrcProto.Type> fileTypes,
- List<OrcProto.ColumnStatistics> stats, boolean[] fileIncluded) throws
FileFormatException {
- List<Integer> internalColIds = Lists.newArrayList();
+ List<OrcProto.ColumnStatistics> stats, boolean[] fileIncluded)
throws FileFormatException {
+ final List<Integer> internalColIds;
+ // exclude ORC `Root` and ACID `Row` struct elements to avoid full
schema size estimation
if (fileIncluded == null) {
- // Add all.
- for (int i = 0; i < fileTypes.size(); i++) {
- internalColIds.add(i);
- }
+ internalColIds = IntStream.range(1, fileTypes.size())
+ .boxed().collect(Collectors.toList());
} else {
- for (int i = 0; i < fileIncluded.length; i++) {
- if (fileIncluded[i]) {
- internalColIds.add(i);
- }
- }
+ internalColIds = IntStream.range(1, fileTypes.size())
+ .filter(i -> fileIncluded[i])
+ .filter(i -> isOriginal || i != OrcRecordUpdater.ROW + 1)
Review Comment:
is it possible to reuse getRootColumn somehow? it would make more sense
```
public static int getRootColumn(boolean isOriginal) {
return isOriginal ? 0 : (OrcRecordUpdater.ROW + 1);
}
```
so maybe:
```
...
filter(i -> i != getRootColumn(isOriginal))
...
```
--
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]