MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / validate_coords

Function validate_coords

nodedb-sql/src/planner/array_dml.rs:61–87  ·  view source on GitHub ↗
(
    array: &str,
    row: usize,
    coords: &[ArrayCoordLiteral],
    view: &ArrayCatalogView,
)

Source from the content-addressed store, hash-verified

59}
60
61fn validate_coords(
62 array: &str,
63 row: usize,
64 coords: &[ArrayCoordLiteral],
65 view: &ArrayCatalogView,
66) -> Result<()> {
67 if coords.len() != view.dims.len() {
68 return Err(SqlError::Parse {
69 detail: format!(
70 "ARRAY {array} row {row}: coord arity {} != dim count {}",
71 coords.len(),
72 view.dims.len()
73 ),
74 });
75 }
76 for (i, c) in coords.iter().enumerate() {
77 if !coord_compatible(c, view.dims[i].dtype) {
78 return Err(SqlError::TypeMismatch {
79 detail: format!(
80 "ARRAY {array} row {row}: coord for dim `{}` (declared {:?}) is incompatible",
81 view.dims[i].name, view.dims[i].dtype
82 ),
83 });
84 }
85 }
86 Ok(())
87}
88
89fn validate_attrs(
90 array: &str,

Callers 2

plan_insert_arrayFunction · 0.85
plan_delete_arrayFunction · 0.85

Calls 3

coord_compatibleFunction · 0.85
lenMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected