nastra commented on code in PR #17433:
URL: https://github.com/apache/iceberg/pull/17433#discussion_r3782231103
##########
core/src/main/java/org/apache/iceberg/V4ManifestReader.java:
##########
@@ -252,6 +272,29 @@ Builder project(Schema newProjection) {
return this;
}
+ /**
+ * Reads content stats for the given table field IDs instead of for every
field. Stats for
+ * fields referenced by the {@link #filter(Expression) filter} are always
read.
+ *
+ * <p>Passing no field IDs reads only the stats that the filter needs.
+ */
+ Builder projectStats(int... fieldIds) {
+ Preconditions.checkArgument(fieldIds != null, "Invalid stats projection
for field IDs: null");
+ return projectStats(ArrayUtil.toIntList(fieldIds));
+ }
+
+ /**
+ * Reads content stats for the given table field IDs instead of for every
field. Stats for
+ * fields referenced by the {@link #filter(Expression) filter} are always
read.
+ *
+ * <p>Passing an empty iterable reads only the stats that the filter needs.
+ */
+ Builder projectStats(Iterable<Integer> fieldIds) {
+ Preconditions.checkArgument(fieldIds != null, "Invalid stats projection
for field IDs: null");
+ this.statsProjectionForFieldIds = ImmutableSet.copyOf(fieldIds);
Review Comment:
In fact I initially had this named `requiredStatsFieldIds` but after
reviewing the code myself it wasn't immediately obvious whether this refers to
the table field IDs that we request stats for or whether we refer to actual
stats field IDs. wdyt about `requestedStatsForFieldIds`?
--
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]