Add support for single value row conditions (#5072)

This commit is contained in:
JT 2022-04-03 10:41:36 +12:00 committed by GitHub
parent 62901573d0
commit 6649da3f5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -3993,7 +3993,7 @@ pub fn parse_math_expression(
let mut last_prec = 1000000;
let mut error = None;
let (lhs, err) = parse_value(
let (mut lhs, err) = parse_value(
working_set,
spans[0],
&SyntaxShape::Any,
@ -4002,6 +4002,13 @@ pub fn parse_math_expression(
error = error.or(err);
idx += 1;
if idx >= spans.len() {
// We already found the one part of our expression, so let's expand
if let Some(row_var_id) = lhs_row_var_id {
expand_to_cell_path(working_set, &mut lhs, row_var_id, expand_aliases_denylist);
}
}
expr_stack.push(lhs);
while idx < spans.len() {

View File

@ -367,3 +367,11 @@ fn proper_rest_types() -> TestResult {
"not verbose!",
)
}
#[test]
fn single_value_row_condition() -> TestResult {
run_test(
r#"[[a, b]; [true, false], [true, true]] | where a | length"#,
"2",
)
}