You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
When where return an empty table, sort-by should still work, or: columns names should not be stripped by filters #5957
That is currently incompatible with the underlying data model. A regular nushell table under the hood is a list of records. This has some nice properties, like that we don't have to do much work ingesting data with potentially any type. But as soon as the list doesn't contain any records, there is nothing defining the columns.
For typed columnar data we currently have the dataframe support. This has the requirement that all values in a column share the same primitive type but allows for much more efficient computations/aggregations. The operations are currently moved over to feel like regular nushell operations but you have to explicitly convert something to a dataframe for them to work.
One possible alternative is to have sort-by work transparently with empty lists. So ([] | sort-by foo) == []. Several other commands that operate on columns already work this way (select, get, rename, where, etc).
Having an explicit Value:: Table is a really thorny design problem, but I don't think it's necessary in order to solve 90% of the cases with this type of issue.
I could make a PR to change the behavior of sort-by if that sounds good?
Activity
sholderbach commentedon Jul 6, 2022
That is currently incompatible with the underlying data model. A regular nushell table under the hood is a list of records. This has some nice properties, like that we don't have to do much work ingesting data with potentially any type. But as soon as the list doesn't contain any records, there is nothing defining the columns.
This might favor having an explicit nu
Value::Tabletype. https://docs.rs/nu-protocol/latest/nu_protocol/enum.Value.html. This may move some checking and missing value handling to the creation time of this table but would be able to have columns with zero rows.For typed columnar data we currently have the dataframe support. This has the requirement that all values in a column share the same primitive type but allows for much more efficient computations/aggregations. The operations are currently moved over to feel like regular nushell operations but you have to explicitly convert something to a dataframe for them to work.
olivia-fl commentedon Mar 29, 2023
One possible alternative is to have
sort-bywork transparently with empty lists. So([] | sort-by foo) == []. Several other commands that operate on columns already work this way (select,get,rename,where, etc).Having an explicit
Value:: Tableis a really thorny design problem, but I don't think it's necessary in order to solve 90% of the cases with this type of issue.I could make a PR to change the behavior of
sort-byif that sounds good?Support passing an empty list to sort, uniq, sort-by, and uniq-by (is…
sholderbach commentedon Mar 30, 2023
Closed by #8669