From c27c27a7e8fff84a446a9686a748d45946d335cd Mon Sep 17 00:00:00 2001 From: dal Date: Thu, 6 Feb 2025 10:46:12 -0700 Subject: [PATCH] fix: Improve column reference validation in model expression checks - Update column validation to use model-defined columns instead of dataset columns - Enhance error message to clarify column reference context - Refine validation logic for expression column references --- api/src/utils/validation/dataset_validation.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/src/utils/validation/dataset_validation.rs b/api/src/utils/validation/dataset_validation.rs index a94c4417f..7c053ff9c 100644 --- a/api/src/utils/validation/dataset_validation.rs +++ b/api/src/utils/validation/dataset_validation.rs @@ -101,11 +101,11 @@ pub async fn validate_model( .collect(); for expr_col in expr_cols { - if !ds_columns.iter().any(|c| c.name == expr_col) { + if !columns.iter().any(|(name, _)| *name == expr_col) { result.add_error(ValidationError::expression_error( col_name, expr, - &format!("Referenced column '{}' not found", expr_col), + &format!("Referenced column '{}' not found in model definition", expr_col), )); } }