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
Mismatches between help messages and actual behaviour #9573
Comments
nice list. we'd love a PR to straighten this out. |
very nice, thanks 😋 |
I updated the comment: I didn't know that |
I don't think it makes sense to say that such commands that only work on lists will work on everything just because they convert their input into a list if it isn't one already. Sure, they don't throw errors but they also don't serve their actual purpose when sorting a list of length 1 etc. Similarly, adding that they work on tables is technically redundant because tables are lists of records, but I see the pedagogical value in adding "including tables" wherever lists of any kind are accepted. |
Regarding the
In fact, several commands now complain about wrong types. |
@dbofmmbt This is because we made our type system more strict with commands. If you look at commands, they have If you see a bunch of commands with these errors, like you're indicating, please file issues for each command because we'd want to fix those. I added this to the signature for parse .input_output_types(vec![
(Type::String, Type::Table(vec![])),
(Type::List(Box::new(Type::Any)), Type::Table(vec![])),
(Type::Binary, Type::Table(vec![])),
]) and can now do this ❯ 0x[66 6f 6f 20 62 61 72] | parse "{a} {b}"
╭#┬─a─┬─b─╮
│0│foo│bar│
╰─┴───┴───╯ Feel free to submit a PR with these changes and an example. |
0.85.0 |
That seems to be a bug in our help rendering. Probably should file a separate issue on that. |
All of the examples now return a |
does that mean that this issue is addressed? 😮 |
I seems so, yeah. |
thanks @KAAtheWiseGit, it looks like i can't reproduce these examples in 0.87.1 👍 please feel free to ask for a reopen if some still don't work 😉 |
@amtoine / @KAAtheWiseGit not sure if I agree on the asessment at face value. The input/output type pairs mentioned in the help text are the same that generate (with some potential technical discrepancies if ambiguous) the type check at parse time. |
Related problem
After issuing #9568, I read other help messages and their implementations. I found many other mismatches between the help messages and actual behaviours. Some of them are too trivial to mention in help messages, (for example, a
range
is treated likelist<int>
) but some have odd behaviours. Below is the list of what I found. It's not exhaustive though: I haven't tested all the commands.parse
0x[66 6f 6f 20 62 61 72] | parse "{a} {b}"
also worksinput list
split list
true | split list "r"
is[[true]]
size
,split chars
,split words
andsplit column
.as_string()
200 | size
,200 | split chars
,2010 | split column "1"
, and200 | split words
works{a: 1, b: 2} | math stddev
is{a: 0, b: 0}
, and{a: [1], b: [2]} | math stddev
is an errorhash md5
andhash sha256
str substring
transpose
true | transpose
is an empty list, but I have no idea what that meanszip
true
is given, it converts that to a list, like[true]
sort
true
is given, it does nothing and returnstrue
.reject
false | reject
isfalse
, but I have no idea what that meansprepend
andappend
true
is given, it converts that to a list. for example,true | prepend false
is[false, true]
select
true
is given, it converts that to a list. for example,true | select 0
is[true]
find
null
if a scalar value is given. for example,200 | find
and200 | find 0
are bothnull
.first
last
.into_iter_strict
, which are lists, binaries, ranges, and streamsdrop column
200 | drop column
andtrue | drop column
are both empty records.It seems like most mismatches are from
v.as_string()
,v.into_iter()
andinput.into_iter()
, wherev
is aValue
andinput
is aPipelineData
. They cause strange behaviours like200 | find
ortrue | select 0
.Describe the solution you'd like
Below are the behaviours that are in the above list and look odd to me.
true | split list "r"
is[[true]]
{a: 1, b: 2} | math stddev
is{a: 0.00, b: 0.00}
true | transpose
is{}
true | sort
istrue
true | reject
istrue
200 | find
isnull
true | drop column
is{}
Describe alternatives you've considered
No response
Additional context and details
No response
The text was updated successfully, but these errors were encountered: