add pagination to examples metric#864
Conversation
| if tbl.num_rows == 0: | ||
| continue | ||
|
|
||
| unique_values = pc.unique(tbl[column_key]).sort() # type: ignore[reportAttributeAccessIssue] |
There was a problem hiding this comment.
Docstring says unique keys should be fragment aligned and in ascending order. So why sort here?
Are datum_id keys fragment aligned? That's probably worth a comment saying so and mentioning why.
There was a problem hiding this comment.
The datum_id column is fragment-aligned BUT is not necessarily ordered within the fragment.
There was a problem hiding this comment.
ive added a comment to better document this
| return | ||
|
|
||
| curr_idx = 0 | ||
| for tbl in source.iterate_tables(filter=modifier): |
There was a problem hiding this comment.
Does the iterator return tables always in the same order? Is the order compatible with the ordering on column_key? (Or does that even matter, seems like it might not as long as it's always the same and keys don't span fragments?)
There was a problem hiding this comment.
Does the iterator return tables always in the same order?
All iterators operate over the underlying cache fragment files in order (e.g. 0000, 0001, 0002, ...).
Is the order compatible with the ordering on column_key?
For the use case of paginating datums there is no interaction. For the primary ingestion cache, each fragment file is datum aligned and there is no rollover.
This fragment-aligned behavior is not the case for other columns and other ranked caches which is why this function lives in compute.py and not directly on the cache readers.
Changes
paginate_indexfunction to cache compute methodscompute_exampleson both classification and object detection evaluatorspyarrow-stubsto dev dependencies for better lintingTesting