Skip to content

add pagination to examples metric#864

Merged
czaloom merged 5 commits into
mainfrom
czaloom-examples-iterator-1-23-26
Jan 27, 2026
Merged

add pagination to examples metric#864
czaloom merged 5 commits into
mainfrom
czaloom-examples-iterator-1-23-26

Conversation

@czaloom

@czaloom czaloom commented Jan 26, 2026

Copy link
Copy Markdown
Collaborator

Changes

  • Added paginate_index function to cache compute methods
  • Added pagination controls to compute_examples on both classification and object detection evaluators
  • Added pyarrow-stubs to dev dependencies for better linting

Testing

  • Added unit tests for both the new cache method and for metric pagination

@czaloom czaloom self-assigned this Jan 26, 2026
@czaloom czaloom requested a review from a team as a code owner January 26, 2026 21:24
if tbl.num_rows == 0:
continue

unique_values = pc.unique(tbl[column_key]).sort() # type: ignore[reportAttributeAccessIssue]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The datum_id column is fragment-aligned BUT is not necessarily ordered within the fragment.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ive added a comment to better document this

return

curr_idx = 0
for tbl in source.iterate_tables(filter=modifier):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@czaloom czaloom merged commit e8d329d into main Jan 27, 2026
4 checks passed
@czaloom czaloom deleted the czaloom-examples-iterator-1-23-26 branch January 27, 2026 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants