From 6a46a462f7636cc5480aa86d73d1d08151903e78 Mon Sep 17 00:00:00 2001 From: ishaksebsib Date: Tue, 21 Oct 2025 12:11:41 +0300 Subject: [PATCH 1/3] fix(hql): handle IS_IN in analyzer correctly as array litral --- .../analyzer/methods/traversal_validation.rs | 41 +++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/helix-db/src/helixc/analyzer/methods/traversal_validation.rs b/helix-db/src/helixc/analyzer/methods/traversal_validation.rs index b8a98473..bc73bae3 100644 --- a/helix-db/src/helixc/analyzer/methods/traversal_validation.rs +++ b/helix-db/src/helixc/analyzer/methods/traversal_validation.rs @@ -1,5 +1,5 @@ use crate::helixc::analyzer::error_codes::*; -use crate::helixc::analyzer::utils::{check_identifier_is_fieldtype, DEFAULT_VAR_NAME}; +use crate::helixc::analyzer::utils::{DEFAULT_VAR_NAME, check_identifier_is_fieldtype}; use crate::helixc::generator::bool_ops::{Contains, IsIn}; use crate::helixc::generator::source_steps::{SearchVector, VFromID, VFromType}; use crate::helixc::generator::traversal_steps::{AggregateBy, GroupBy}; @@ -719,8 +719,7 @@ pub(crate) fn validate_traversal<'a>( | BooleanOpType::GreaterThan(expr) | BooleanOpType::Equal(expr) | BooleanOpType::NotEqual(expr) - | BooleanOpType::Contains(expr) - | BooleanOpType::IsIn(expr) => { + | BooleanOpType::Contains(expr) => { match infer_expr_type( ctx, expr, @@ -744,6 +743,42 @@ pub(crate) fn validate_traversal<'a>( } } } + BooleanOpType::IsIn(expr) => { + match infer_expr_type( + ctx, + expr, + scope, + original_query, + Some(cur_ty.clone()), + gen_query, + ) { + (Type::Array(boxed_ty), _) => match *boxed_ty { + Type::Scalar(ft) => ft, + _ => { + generate_error!( + ctx, + original_query, + b_op.loc.clone(), + E621, + &b_op.loc.span, + "Array elements must be of a scalar type (e.g., ID, String, F32, I32, etc.)" + ); + return Some(Type::Unknown); + } + }, + (field_type, _) => { + generate_error!( + ctx, + original_query, + b_op.loc.clone(), + E621, + &b_op.loc.span, + field_type.kind_str() + ); + return Some(field_type); + } + } + } _ => return Some(cur_ty.clone()), }; From eb43b3dce180606faba599b51329e45699312e5b Mon Sep 17 00:00:00 2001 From: ishaksebsib Date: Tue, 21 Oct 2025 12:12:45 +0300 Subject: [PATCH 2/3] fix(hql): Change check_property("id") to return Value::Id for type safety --- helix-db/src/utils/filterable.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helix-db/src/utils/filterable.rs b/helix-db/src/utils/filterable.rs index aca51c3e..1cbe5e8b 100644 --- a/helix-db/src/utils/filterable.rs +++ b/helix-db/src/utils/filterable.rs @@ -123,7 +123,7 @@ impl Filterable for Node { #[inline(always)] fn check_property(&self, key: &str) -> Result, GraphError> { match key { - "id" | "ID" | "Id"=> Ok(Cow::Owned(Value::String(ID::from(self.id).stringify()))), + "id" | "ID" | "Id"=> Ok(Cow::Owned(Value::Id(ID::from(self.id)))), "label" => Ok(Cow::Owned(Value::from(self.label.to_string()))), _ => match &self.properties { Some(properties) => properties From 0c933b3ccbb1f6caf65c7d98038d921d268b7919 Mon Sep 17 00:00:00 2001 From: ishaksebsib Date: Tue, 21 Oct 2025 14:45:09 +0300 Subject: [PATCH 3/3] fix(hql): check peroperty to return vaild id for vector and edges --- helix-db/src/helix_engine/vector_core/vector.rs | 4 ++-- helix-db/src/utils/filterable.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/helix-db/src/helix_engine/vector_core/vector.rs b/helix-db/src/helix_engine/vector_core/vector.rs index 125949f0..a54a0c56 100644 --- a/helix-db/src/helix_engine/vector_core/vector.rs +++ b/helix-db/src/helix_engine/vector_core/vector.rs @@ -6,7 +6,7 @@ use crate::{ protocol::{return_values::ReturnValue, value::Value}, utils::{ filterable::{Filterable, FilterableType}, - id::v6_uuid, + id::{v6_uuid, ID}, }, }; use core::fmt; @@ -273,7 +273,7 @@ impl Filterable for HVector { fn check_property(&self, key: &str) -> Result, GraphError> { match key { - "id" => Ok(Cow::Owned(Value::from(self.uuid()))), + "id" => Ok(Cow::Owned(Value::Id(ID::from(self.id)))), "label" => Ok(Cow::Owned(Value::from(self.label().to_string()))), "data" => Ok(Cow::Owned(Value::Array( self.data.iter().map(|f| Value::F64(*f)).collect(), diff --git a/helix-db/src/utils/filterable.rs b/helix-db/src/utils/filterable.rs index 1cbe5e8b..2ba771ad 100644 --- a/helix-db/src/utils/filterable.rs +++ b/helix-db/src/utils/filterable.rs @@ -227,7 +227,7 @@ impl Filterable for Edge { #[inline(always)] fn check_property(&self, key: &str) -> Result, GraphError> { match key { - "id" => Ok(Cow::Owned(Value::from(self.uuid()))), + "id" => Ok(Cow::Owned(Value::Id(ID::from(self.id)))), "label" => Ok(Cow::Owned(Value::from(self.label.to_string()))), "from_node" => Ok(Cow::Owned(Value::from(self.from_node_uuid()))), "to_node" => Ok(Cow::Owned(Value::from(self.to_node_uuid()))),