✨ feat(mq-lang): add native _csv_parse builtin using csv crate#1456
Merged
✨ feat(mq-lang): add native _csv_parse builtin using csv crate#1456
Conversation
Replace the pure-mq CSV parsing implementation in csv.mq with a native Rust builtin `_csv_parse(csv, delimiter?, has_header?)` backed by the `csv` crate. - Signature: `_csv_parse(csv: String, delimiter?: String, has_header?: Boolean)` - `delimiter` defaults to `","` when omitted - `has_header` defaults to `false` when omitted - Returns `Array<Dict>` when `has_header` is true (keys from header row) - Returns `Array<Array>` when `has_header` is false - Handles RFC 4180 quoting and escaping via the csv crate - Update csv.mq wrappers (csv_parse, tsv_parse, psv_parse, csv_parse_with_delimiter) to delegate to the new builtin - Add rstest parameterized tests covering no-header, with-header, quoted fields, custom delimiter (TSV), and invalid argument types
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a native CSV parsing implementation to mq-lang by introducing an internal _csv_parse builtin backed by the Rust csv crate, and rewires the csv module to use it.
Changes:
- Introduces
_csv_parsebuiltin (1–3 args) that parses CSV/TSV/PSV into runtime arrays/dicts. - Updates
crates/mq-lang/modules/csv.mqparse helpers to delegate to_csv_parse. - Adds the
csvdependency to the workspace andmq-lang, plus new unit tests for_csv_parse.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/mq-lang/src/eval/builtin.rs | Adds _csv_parse builtin, hash registration, internal docs entry, and Rust unit tests. |
| crates/mq-lang/modules/csv.mq | Switches module-level parsing functions to call the new builtin. |
| crates/mq-lang/Cargo.toml | Adds csv as a crate dependency via workspace. |
| Cargo.toml | Adds csv to workspace dependency versions. |
| Cargo.lock | Locks csv + transitive deps. |
Merging this PR will improve performance by 50.97%
Performance Changes
Comparing Footnotes |
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.
No description provided.