feat(stdlib): jq entries commands#1653
feat(stdlib): jq entries commands#1653close2code-palm wants to merge 12 commits intovectordotdev:mainfrom
Conversation
|
@codex review |
|
Apologies for the late review. Please fix and the merge conflicts and we will take a look. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea98b04ca3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let key = i64::try_from(index) | ||
| .map_err(|_| ValueError::OutOfRange(Kind::integer()))?; | ||
| Ok(build_entry(Value::from(key), value)) |
There was a problem hiding this comment.
Emit string keys for array entries
In the array branch, to_entries stores each index as an integer key, but from_entries only accepts string keys (Value::Bytes) and rejects non-strings. This means a direct round-trip like from_entries(to_entries([1,2])) now fails with object keys must be strings, so the two new functions are not interoperable for arrays. Converting the index to a string when building each entry avoids this regression.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Implementation preserves semantics of original tool, where commands are not opposite to each other
…jq-entries-commands # Conflicts: # src/stdlib/mod.rs
…ode-palm/vrl into feat/jq-entries-commands
|
The Please run the following and commit the result: |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6bd0a1d1aa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
I did a little research to know the difference between my implementation and jq`s specification. I found some interesting points. I had only the minimalistic conversion feature on my mind, but I can work on my PoC to keep feature as rich as it is in jq. Let me work on it. |
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Please add a changelog to describe these new features. |
feat(stdlib): Add to_entries and from_entries functions, compatible with commands in jq tool
Summary
Implemented two functions for stdlib with tests
Closes #124
Change Type
Is this a breaking change?
How did you test this PR?
Added unit tests for general cases, ran the vector with my local VRL and made common transfers
Does this PR include user facing changes?
our guidelines.
Checklist
run
dd-rust-license-tool writeand commit the changes. More details here.Before to add documentation, I want to ensure that this feature is acceptable, as there was no activity in issue
References