Skip to content

Commit 42ddb5d

Browse files
committed
fix
Signed-off-by: Matt Katz <mhkatz97@gmail.com>
1 parent 2fcc162 commit 42ddb5d

1 file changed

Lines changed: 6 additions & 17 deletions

File tree

vortex-duckdb/src/convert/expr.rs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ fn try_from_bound_function(
133133
}
134134
"array_length" => {
135135
let children = func.children().collect::<Vec<_>>();
136-
// Only accept `array_length` with one arg (not the array_length(expr, dim) form)
136+
// Only accept array_length(expr) rather than array_length(expr, dim).
137137
if children.len() != 1 {
138138
return Ok(None);
139139
}
@@ -142,8 +142,7 @@ fn try_from_bound_function(
142142
};
143143

144144
// We don't know the column's nullability here, so we set it to nullable.
145-
let list_len_expr = build_list_length(col, Nullability::Nullable);
146-
list_len_expr
145+
build_list_length(col, Nullability::Nullable)
147146
}
148147
// len/length semantics depend on the return type of underlying expr.
149148
"len" | "length" => {
@@ -271,22 +270,12 @@ pub fn try_from_projection_expression(
271270
Some(col)
272271
}
273272
"array_length" => {
274-
if func.children().count() == 1 {
275-
let expr = list_length_on_field(field);
276-
Some(expr)
277-
} else {
278-
None
279-
}
273+
// Only accept array_length(expr) rather than array_length(expr, dim).
274+
(func.children().count() == 1).then(|| list_length_on_field(field))
280275
}
281276
// len/length have different semantics depending on field dtype.
282-
"len" | "length" => {
283-
if matches!(field.dtype, DType::List(..) | DType::FixedSizeList(..)) {
284-
let expr = list_length_on_field(field);
285-
Some(expr)
286-
} else {
287-
None
288-
}
289-
}
277+
"len" | "length" => matches!(field.dtype, DType::List(..) | DType::FixedSizeList(..))
278+
.then(|| list_length_on_field(field)),
290279
_ => None,
291280
})
292281
}

0 commit comments

Comments
 (0)