Skip to content

Commit 986f8ef

Browse files
authored
Merge pull request #219 from cipherstash/fix/eql-mapper/named-arrays
fix(mapper): support named arrays
2 parents 927cc23 + 2337278 commit 986f8ef

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

packages/eql-mapper/src/inference/infer_type_impls/expr.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -436,18 +436,13 @@ impl<'ast> InferType<'ast, Expr> for TypeInferencer<'ast> {
436436
self.unify_node_with_type(this_expr, elem_ty)?;
437437
}
438438

439-
Expr::Array(Array { elem, named: false }) => {
439+
Expr::Array(Array { elem, named: _ }) => {
440440
// Constrain all elements of the array to be the same type.
441441
let elem_ty = self.unify_all_with_type(elem, self.fresh_tvar())?;
442442
let array_ty = Type::array(elem_ty);
443443
self.unify_node_with_type(this_expr, array_ty)?;
444444
}
445445

446-
Expr::Array(Array {
447-
elem: _,
448-
named: true,
449-
}) => Err(TypeError::UnsupportedSqlFeature("named arrays".to_string()))?,
450-
451446
// interval is unmapped, value is unmapped
452447
Expr::Interval(interval) => {
453448
self.unify_node_with_type(this_expr, Type::any_native())?;

packages/eql-mapper/src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,4 +1351,16 @@ mod test {
13511351
Err(err) => panic!("type check failed: {err}"),
13521352
}
13531353
}
1354+
1355+
#[test]
1356+
fn supports_named_arrays() {
1357+
let schema = resolver(schema! {
1358+
tables: {
1359+
}
1360+
});
1361+
1362+
let statement = parse("SELECT ARRAY[1, 2, 3]");
1363+
1364+
type_check(schema, &statement).expect("named arrays should be supported");
1365+
}
13541366
}

0 commit comments

Comments
 (0)