Add runnable examples to CTable where and sort_by - #711
Merged
FrancescAlted merged 3 commits intoSep 24, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Address the two documentation nits before approval.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds runnable examples to CTable.where() and CTable.sort_by() docstrings.
Changes:
- Demonstrates filtering, projection, compound predicates, and sorting.
- Adds materialized, lazy, and multi-key sorting examples.
- Includes expected outputs clarifying view behavior.
File summaries
| File | Summary |
|---|---|
src/blosc2/ctable.py |
Adds where() and sort_by() examples; needs an explicit blosc2 import and clearer eager sort-key computation wording. |
Review details
Suppressed comments (2)
src/blosc2/ctable.py:13944
- This wording implies that sorting is deferred until the result is read, but
sort_by()has already scanned the view and materialized the sort-key column(s) to compute the full permutation before returning; only the returned row/column data remains lazy. Please clarify that this creates a lazy view while the sort order is computed eagerly.
Sorting a filtered table stays lazy until rows are read::
src/blosc2/ctable.py:15748
- This advertised runnable example uses
blosc2.field,blosc2.string, andblosc2.CTable, but only importsdataclass. It happens to pass when doctested fromctable.pybecauseblosc2is already a module global, but copying the example into a fresh REPL or script raisesNameError; add the package import as the other runnable examples in this file do.
>>> from dataclasses import dataclass
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Member
|
Hi @armutlutost . Thanks for your contribution. Copilot is suggesting a couple of improvements; please have a closer look. |
Fix import statement formatting in ctable.py Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add runnable examples to the
CTable.where()andCTable.sort_by()docstrings.The examples demonstrate filtering, column projection, compound predicates, plain sorting, lazy sorting of a filtered view, and multi-key sorting.
Closes #650
Changes
CTablesetup to both docstrings.where()with a simple predicate and selected columns.Validation
python -m py_compile src/blosc2/ctable.pygit diff --checkThe repository’s required
blosc2Conda environment was unavailable locally, so the documentation examples were not executed against the compiled extension.AI disclosure
AI assistance was used to draft the documentation examples. I reviewed the changes before submitting this pull request.