rdblue commented on code in PR #9366:
URL: https://github.com/apache/iceberg/pull/9366#discussion_r1439064941


##########
core/src/main/java/org/apache/iceberg/avro/AvroIterable.java:
##########
@@ -78,7 +79,8 @@ public CloseableIterator<D> iterator() {
     if (start != null) {
       if (reader instanceof SupportsRowPosition) {
         ((SupportsRowPosition) reader)
-            .setRowPositionSupplier(() -> 
AvroIO.findStartingRowPos(file::newStream, start));
+            .setRowPositionSupplier(
+                Suppliers.memoize(() -> 
AvroIO.findStartingRowPos(file::newStream, start)));

Review Comment:
   Previously, this was being done in the `StructValueReader`. If the struct 
[reader inserted a 
`PositionReader`](https://github.com/apache/iceberg/pull/9366/files#diff-08597bac062ea934a49ebeb66da72f459dea1da642e1df2cdd2c8ca6884fed4dL626-L631),
 it would also rewrite the position supplier.
   
   That was a lot of complication for the value reader and didn't work in all 
cases (for example, if two structs had position columns) so I moved the 
memoization here. It's simpler that way.



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to