Skip to content

Fix select cell path renaming behavior#13361

Merged
sholderbach merged 2 commits intonushell:mainfrom
sholderbach:fix-select-cellpath-renaming
Jul 13, 2024
Merged

Fix select cell path renaming behavior#13361
sholderbach merged 2 commits intonushell:mainfrom
sholderbach:fix-select-cellpath-renaming

Conversation

@sholderbach
Copy link
Copy Markdown
Member

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 selected 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

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.
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.
@sholderbach
Copy link
Copy Markdown
Member Author

As the logic here currently uses Display there is another gotcha as soon as we fix #13362, a . in the column name would require quotes for the display but then select would accidentally introduce a new set of "". So we probably have to specifically implement this for whatever behavior is desired in this select name flattening, instead of relying on Display

Copy link
Copy Markdown
Member

@IanManske IanManske left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@devyn devyn added notes:mention Include the release notes summary in the "Hall of Fame" section notes:breaking-changes This PR implies a change affecting users and has to be noted in the release notes labels Jul 13, 2024
@sholderbach
Copy link
Copy Markdown
Member Author

I think there is more work to be done around select's multi level behavior and the abuse of Display in cell path. But I will go with Ian's approval to get the issue closed.

@sholderbach sholderbach merged commit f5bff8c into nushell:main Jul 13, 2024
@sholderbach sholderbach deleted the fix-select-cellpath-renaming branch July 13, 2024 14:54
@hustcer hustcer added this to the v0.96.0 milestone Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notes:breaking-changes This PR implies a change affecting users and has to be noted in the release notes notes:mention Include the release notes summary in the "Hall of Fame" section

Projects

None yet

Development

Successfully merging this pull request may close these issues.

select renames my columns

4 participants