Repository navigation
Closed
Labels
category:bugSomething isn't workingsemanticsPlaces where we should define/clarify nushell's semantics
Description
Describe the bug
The select command uses ColumnPaths internally which allows users to write paths containing literal dots by surrounding these segments with quote characters. default and compact however treat their path inputs as strings split on each . and are thus incapable of such functionality. This limits their functionality when dealing with data files containing URLs for example. I ran into the issue when trying to clean up some data pertaining to a kubernetes cluster.
How to reproduce
❯ echo '[{ "labels": { "app.kubernetes.io/name": "my-great-app" } }, { "labels": {} }]' | from json | default labels.'app.kubernetes.io/name' unknown | select labels.'app.kubernetes.io/name'
───┬───────────────────────────────
# │ labels_app_kubernetes_io/name
───┼───────────────────────────────
0 │ my-great-app
1 │
───┴───────────────────────────────
Expected behavior
I would expect the above command to print unknown for the label value in row 1.
Screenshots
No response
Configuration
| Column0 | Column1 |
| ------------------ | -------------------------------------------------------- |
| version | 0.43.0 |
| build_os | macos-aarch64 |
| rust_version | rustc 1.58.1 (db9d1b20b 2022-01-20) |
| rust_channel | stable-aarch64-apple-darwin |
| cargo_version | cargo 1.58.0 (f01b232bc 2022-01-19) |
| pkg_version | 0.43.0 |
| build_time | 2022-01-21 17:16:49 -08:00 |
| build_rust_channel | release |
| features | ctrlc, dataframe, default, rustyline, term, which, zip |
| installed_plugins | chart bar, chart line, fetch, match, post, ps, sys, tree |
Additional context
No response
Metadata
Metadata
Assignees
Labels
category:bugSomething isn't workingsemanticsPlaces where we should define/clarify nushell's semantics
Activity
Add ColumnPath support to default/compact
fdncred commentedon Feb 9, 2022
hey @lily-mara - engine-q is merged now into nushell/main. does this problem still exist? I see the output is a little different.
lily-mara commentedon Feb 9, 2022
Yes, the issue is still present though the output is now slightly different.
I can try to take a pass at this now that engine-q is merged in.
sophiajt commentedon Aug 9, 2023
This still repros in the latest main.
weirdan commentedon Feb 10, 2026
defaultdoesn't take cell paths, only column names. Also thedefaultarguments are in the wrong order (but maybe it was correct back then).Current approach is to use
update col { default value subcolumn }:kronberger-droid commentedon Nov 13, 2026
The
defaulthalf got fixed by #19058.compactis still open on 0.117:returns an empty list, also dropping the row that has a value.
I narrowed the title to
compact.[-]`default` and `compact` do not support path segments containing literal dots[/-][+]`compact` does not support nested cell paths[/+]compact: accept cell paths for column arguments (nushell#19624)