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 and enabled us to add position readers
that are constructed in the same place as the other readers, instead of needing
to keep track of the position index in a struct and inject when
`setRowPositionSupplier` is called.
--
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]