Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add values command (see #7166) #7583

Merged
merged 4 commits into from
Dec 23, 2022
Merged

Add values command (see #7166) #7583

merged 4 commits into from
Dec 23, 2022

Conversation

webbedspace
Copy link
Contributor

Description

This adds a counterpart to columns called values (see #7166 for name motivation). This can be combined with each to iterate over the values of a record (which is useful when the record is holding homogenous data). When given a table, it produces a list of columns (list of lists). Holes are not preserved (for obvious reasons).

This differs slightly from columns in that it will error if given a non-record non-table.

User-Facing Changes

See above.

Tests + Formatting

Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

  • cargo fmt --all -- --check to check standard code formatting (cargo fmt --all applies these changes)
  • cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect to check that you're using the standard code style
  • cargo test --workspace to check that all tests pass

After Submitting

If your PR had any user-facing changes, update the documentation after the PR is merged, if necessary. This will help us keep the docs up to date.

@fdncred
Copy link
Collaborator

fdncred commented Dec 23, 2022

Nice work!

One thing that kind of jumps out at me is the name of the command. I'm not asking for a change but I think about it like this. keys and values go together. columns and values seems different. And then since nushell is built on the Value enum, I wonder if people get confused that values could mean spitting out the nushell Value enum representation? Of course, end users may have no clue that nushell is built on an enum Value, so it may not make any difference. Just thinking out loud.

@stormasm
Copy link
Contributor

@fdncred I would like to go ahead and land this one...
Or you can do it...
This is going to be helpful for me right now with the
Arrow RecordBatch

@fdncred fdncred merged commit b16b3c0 into nushell:main Dec 23, 2022
@fdncred
Copy link
Collaborator

fdncred commented Dec 23, 2022

You got it @stormasm. Thanks @webbedspace

@webbedspace webbedspace deleted the values-cmd branch December 23, 2022 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants