Skip to content

List of records is not transformed into a table if record fields are not all in the same order #11646

Open
@Yethal

Description

Describe the bug

If a nushell pipeline returns a list of records and all records contain the same fields in the same order, it will be transformed into a table (describe will return table<fields>. However if there is any mismatch in the ordering of the fields (even if the fields are the same) then reported type will be list<any>

How to reproduce

  1. Run
seq 1 10
| par-each {|x|
    [[version patch]; ['1.0.0' false] ['3.0.1' true] ['2.0.0' false]]
    # | shuffle
    | transpose -i -r -d
}
| describe
  1. Notice the reported type is table<1.0.0: bool, 3.0.1: bool, 2.0.0: bool> (stream)
  2. Uncomment the shuffle step and rerun the code
  3. Notice the reported type is list<any> (stream)

Expected behavior

I expected nu to consistently convert list of records to table

Screenshots

No response

Configuration

key value
version 0.89.0
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.75.0 (82e1608df 2023-12-21)
rust_channel stable-x86_64-unknown-linux-gnu
cargo_version cargo 1.75.0 (1d8b05cdd 2023-11-20)
build_time 2024-01-10 11:03:39 +01:00
build_rust_channel release
allocator mimalloc
features dataframe, default, extra, sqlite, trash, which, zip
installed_plugins from eml, from hcl, from ics, from ini, from tf, from vcf, gstat, inc, net, query, query json, query web, query xml

Additional context

No response

Metadata

Assignees

No one assigned

    Labels

    semanticsPlaces where we should define/clarify nushell's semanticstype-systemProblems or features related to nushell's type system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions