Skip to content

where implicitly coerces records to tables instead of returning the record (if condition is true) #6764

@webbedspace

Description

@webbedspace

Describe the bug

When piped a record, and if the condition is true regarding the record, where will NOT return the record, but a table of it.

How to reproduce

See example:

〉{A:1,B:2}
╭───┬───╮
│ A │ 1 │
│ B │ 2 │
╰───┴───╯
〉{A:1,B:2} | where A == 1
╭───┬───┬───╮
│ # │ A │ B │
├───┼───┼───┤
│ 0 │ 1 │ 2 │
╰───┴───┴───╯

Expected behavior

I understand the type signature of where is a little dicey at the moment, but there is one principle I think it should uphold: not type-coercing the data like 90s JavaScript. As such, I think its current behaviour regarding JSON-style records is rather unpleasant. I expect where to filter data, not transform it.

Screenshots

No response

Configuration

key value
version 0.69.1
branch
commit_hash 8a5abc7
build_os windows-x86_64
build_target x86_64-pc-windows-msvc
rust_version rustc 1.64.0 (a55dd71d5 2022-09-19)
rust_channel stable-x86_64-pc-windows-msvc
cargo_version cargo 1.64.0 (387270bc7 2022-09-16)
pkg_version 0.69.1
build_time 2022-09-28 02:58:08 +00:00
build_rust_channel release
features database, dataframe, default, trash, which, zip
installed_plugins

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    category:inconsistent-behaviorBehavior between different commands or types inconsistent/unexpected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions