aokolnychyi commented on code in PR #8346:
URL: https://github.com/apache/iceberg/pull/8346#discussion_r1298826045
##########
api/src/main/java/org/apache/iceberg/BaseScanTaskGroup.java:
##########
@@ -28,12 +28,18 @@
public class BaseScanTaskGroup<T extends ScanTask> implements ScanTaskGroup<T>
{
private final StructLike groupingKey;
private final Object[] tasks;
- private transient volatile List<T> taskList;
+
+ // lazy variables
+ private transient volatile Collection<T> taskCollection;
+ private transient volatile long sizeBytes = Long.MIN_VALUE;
+ private transient volatile long estimatedRowsCount = Long.MIN_VALUE;
+ private transient volatile int filesCount = Integer.MIN_VALUE;
public BaseScanTaskGroup(StructLike groupingKey, Collection<T> tasks) {
Preconditions.checkNotNull(tasks, "tasks cannot be null");
this.groupingKey = groupingKey;
this.tasks = tasks.toArray();
+ this.taskCollection = Collections.unmodifiableCollection(tasks);
Review Comment:
No need to create a list of tasks unless this task group was serialized. We
pass a collection here that gets immediately converted to an array for
serialization purposes. This task group is then still accessed on the driver
via the public `tasks()` method, which creates another collection while we
could have used the one that was passed.
--
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]