Add aliasing support to REPL select() and group_by()#59
Merged
Conversation
select() arguments (plain columns or aggregates) can now be renamed via `name: value` / `"quoted name": value` keyword syntax. group_by() keys can similarly carry their own alias, which becomes the default output name unless overridden by a matching select() alias.
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
select()arguments (plain columns or aggregates) can be renamed vianame: valuekeyword syntax, e.g.select(:foo, foo_bar: :bar, total: sum(:qty)). Quoted names ("name with space": value) are supported for names that aren't valid bare identifiers.group_by()keys can carry their own alias (e.g.group_by(key: :foo)), which becomes the default output name for that key.select()may refer to the key by its underlying column or by thegroup_by()alias; a matchingselect()alias takes precedence when present.Changes
src/pipeline/spec.rs: parse/model aliases forselect()args andgroup_by()keyssrc/pipeline/record_batch.rs,src/pipeline/dataframe/transform.rs: apply aliases when building output batches/dataframessrc/pipeline/builder.rs,src/pipeline.rs: wire alias info through the pipeline buildersrc/cli/repl/plan.rs,src/cli/repl/stage.rs,src/cli/repl/builder_bridge.rs,src/cli/repl/mod.rs: REPL-side plumbing for alias syntaxfeatures/repl/select.feature: Cucumber scenarios covering aliasing behaviordocs/REPL.md,CHANGELOG.md: document the new syntax and behaviorTesting
cargo check --all-targetspassescargo testand the Cucumber suite (features/repl/select.feature) to verify aliasing behavior end to endChecklist