Soft rest arguments column path cohersions.#3016
Merged
andrasio merged 1 commit intonushell:mainfrom Feb 7, 2021
Merged
Conversation
sholderbach
added a commit
to sholderbach/nushell
that referenced
this pull request
Jul 12, 2024
Fixes nushell#13359 In an attempt to generate names for flat columns resulting from a nested accesses nushell#3016 generated new column names on nested selection, out of convenience, that composed the cell path as a string (including `.`) and then simply replaced all `.` with `_`. As we permit `.` in column names as long as you quote this surprisingly alters `select`ed columns.
sholderbach
added a commit
that referenced
this pull request
Jul 13, 2024
# Description Fixes #13359 In an attempt to generate names for flat columns resulting from a nested accesses #3016 generated new column names on nested selection, out of convenience, that composed the cell path as a string (including `.`) and then simply replaced all `.` with `_`. As we permit `.` in column names as long as you quote this surprisingly alters `select`ed columns. # User-Facing Changes New columns generated by selection with nested cell paths will for now be named with a string containing the keys separated by `.` instead of `_`. We may want to reconsider the semantics for nested access. # Tests + Formatting - Alter test to breaking change on nested `select`
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.
Closes #2979 , #2985 and probably few more I can't find in issues logged.
A couple of things.
argumentshelper is applied in more places (getandselect, to be exact, by changing their signature type to accept aSyntaxShape::Anyrather thanSyntaxShape::ColumnPathwhich allows passing it any value type that can be converted on runtime to a column path allowing things like invocations in the arguments. Originally extracted out fromempty?command.This allows to convert the values passed to column path types and optionally determine if a block is passed at the end. This pattern (like
empty?) is commonly showing up where you need to pass in columns to a command and you are interested also in having the command do a different behavior if also a block is passed to it.With this is place, here are two examples. Given the following source file having (at the time of this writing,
41columns). The second command we just get the last 5 column names for demonstration purposes. This file also changes everyday (more columns).Say we are interested in selecting just the
provinciacolumn and some random columns from January, we can do, like so:This means
selectcan also take Table types (the output of the invocation in positional argument and converts them to column paths as well)The
getcommand also supports it now.