Skip to content

Commit abf1347

Browse files
committed
fix
1 parent 98193e2 commit abf1347

1 file changed

Lines changed: 20 additions & 30 deletions

File tree

crates/lance-graph/src/semantic.rs

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -915,39 +915,29 @@ impl SemanticAnalyzer {
915915
location: snafu::Location::new(file!(), line!(), column!()),
916916
})?;
917917

918-
match self.json_to_property_value(param_value)? {
919-
// Try to convert to VectorLiteral if it's an array of numbers
920-
// Since PropertyValue doesn't support generic lists yet, strict JSON array -> PropertyValue
921-
// will likely fail or return Null/String. But we want to support VectorLiteral.
922-
// Let's rely on json_to_property_value first.
923-
// Wait, PropertyValue doesn't have VectorLiteral. ValueExpression does.
924-
// We need a way to convert JSON array to VectorLiteral.
925-
_ => {
926-
// Check for array to VectorLiteral conversion
927-
if let serde_json::Value::Array(arr) = param_value {
928-
let mut floats = Vec::new();
929-
for v in arr {
930-
if let Some(f) = v.as_f64() {
931-
floats.push(f as f32);
932-
} else {
933-
return Err(GraphError::PlanError {
934-
message: format!(
935-
"Parameter ${} is a list but contains non-numeric values. Only float vectors are supported as list parameters currently.",
936-
name
937-
),
938-
location: snafu::Location::new(file!(), line!(), column!()),
939-
});
940-
}
941-
}
942-
*expr = ValueExpression::VectorLiteral(floats);
943-
return Ok(());
918+
// Check for array to VectorLiteral conversion
919+
if let serde_json::Value::Array(arr) = param_value {
920+
let mut floats = Vec::new();
921+
for v in arr {
922+
if let Some(f) = v.as_f64() {
923+
floats.push(f as f32);
924+
} else {
925+
return Err(GraphError::PlanError {
926+
message: format!(
927+
"Parameter ${} is a list but contains non-numeric values. Only float vectors are supported as list parameters currently.",
928+
name
929+
),
930+
location: snafu::Location::new(file!(), line!(), column!()),
931+
});
944932
}
945-
946-
// Scalar conversion
947-
let prop_val = self.json_to_property_value(param_value)?;
948-
*expr = ValueExpression::Literal(prop_val);
949933
}
934+
*expr = ValueExpression::VectorLiteral(floats);
935+
return Ok(());
950936
}
937+
938+
// Scalar conversion
939+
let prop_val = self.json_to_property_value(param_value)?;
940+
*expr = ValueExpression::Literal(prop_val);
951941
}
952942
ValueExpression::ScalarFunction { args, .. }
953943
| ValueExpression::AggregateFunction { args, .. } => {

0 commit comments

Comments
 (0)