RussellSpitzer commented on code in PR #8346:
URL: https://github.com/apache/iceberg/pull/8346#discussion_r1301814417
##########
api/src/main/java/org/apache/iceberg/BaseScanTaskGroup.java:
##########
@@ -48,20 +54,59 @@ public StructLike groupingKey() {
@Override
@SuppressWarnings("unchecked")
public Collection<T> tasks() {
- if (taskList == null) {
+ if (taskCollection == null) {
synchronized (this) {
- if (taskList == null) {
+ if (taskCollection == null) {
ImmutableList.Builder<T> listBuilder =
ImmutableList.builderWithExpectedSize(tasks.length);
for (Object task : tasks) {
listBuilder.add((T) task);
}
- taskList = listBuilder.build();
+ this.taskCollection = listBuilder.build();
}
}
}
- return taskList;
+ return taskCollection;
+ }
+
+ @Override
+ public long sizeBytes() {
+ if (sizeBytes == Long.MIN_VALUE) {
+ long size = 0L;
+ for (Object task : tasks) {
+ size += ((ScanTask) task).sizeBytes();
+ }
+ this.sizeBytes = size;
+ }
+
+ return sizeBytes;
+ }
+
+ @Override
+ public long estimatedRowsCount() {
Review Comment:
Why not just calculate these values in the constructor? I feel like we pass
over this array a bunch of times and we could just figure out these values at
the beginning?
--
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]