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
This commit is contained in:
dal 2025-02-06 10:46:12 -07:00
parent 2618166bf8
commit c27c27a7e8
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
1 changed files with 2 additions and 2 deletions

View File

@ -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),
));
}
}