✨ feat(table): add map_rows, filter_rows, and sort_rows functions#1230
✨ feat(table): add map_rows, filter_rows, and sort_rows functions#1230
Conversation
Add row transformation operations to the table module: - map_rows: applies a function to each row - filter_rows: filters rows based on a predicate - sort_rows: sorts rows by column index or default ordering Also registers the table module in the resolver for static lookup.
There was a problem hiding this comment.
Pull request overview
Adds row-level transformation helpers to the table module and enables static module resolution for table.
Changes:
- Register
tablein the module resolver for static lookup. - Add
map_rows,filter_rows, andsort_rowshelpers tomodules/table.mq. - Add module tests covering the new row transformation functions.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| crates/mq-lang/src/module/resolver.rs | Adds table to the static module-name mapping. |
| crates/mq-lang/modules/table.mq | Introduces row transformation helpers (map/filter/sort) for table rows. |
| crates/mq-lang/modules/module_tests.mq | Adds tests validating row mapping, filtering, and sorting behavior. |
| end | ||
|
|
||
| # Map a function over each row in the table. | ||
| def map_rows(table, f): |
There was a problem hiding this comment.
The parameter name f is ambiguous for public helpers; it’s unclear whether it’s a row-mapper or predicate. Consider renaming to something more specific (e.g., row_fn / predicate) to make call sites self-documenting.
| end | ||
|
|
||
| # Filter rows in the table based on a predicate function. | ||
| def filter_rows(table, f): |
There was a problem hiding this comment.
The parameter name f is ambiguous for public helpers; it’s unclear whether it’s a row-mapper or predicate. Consider renaming to something more specific (e.g., row_fn / predicate) to make call sites self-documenting.
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
Footnotes |
Add row transformation operations to the table module:
Also registers the table module in the resolver for static lookup.