Skip to content

Commit 09ab418

Browse files
committed
Handle non-nullable expressions in update bindings
This update ensures non-nullable expressions are unified with nullable data types where required, maintaining consistency in type handling. Additionally, it includes error logging for cases when data type retrieval fails, improving debugging visibility.
1 parent 85e27f5 commit 09ab418

File tree

1 file changed

+17
-3
lines changed
  • src/query/sql/src/planner/binder/bind_mutation

1 file changed

+17
-3
lines changed

src/query/sql/src/planner/binder/bind_mutation/update.rs

+17-3
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,23 @@ impl Binder {
171171
.iter()
172172
.flat_map(|eval| {
173173
eval.update.iter().flat_map(|update| {
174-
update
175-
.values()
176-
.flat_map(|expr| expr.used_columns().into_iter())
174+
update.values().flat_map(|expr| {
175+
let processed_expr = expr
176+
.data_type()
177+
.map(|data_type| {
178+
if !data_type.is_nullable_or_null() {
179+
expr.clone()
180+
.unify_to_data_type(&data_type.nest_wrap_nullable())
181+
} else {
182+
expr.clone()
183+
}
184+
})
185+
.unwrap_or_else(|_| {
186+
log::error!("Failed to get data type for expression");
187+
expr.clone()
188+
});
189+
processed_expr.used_columns().into_iter()
190+
})
177191
})
178192
})
179193
.chain(mutation.required_columns.iter().copied())

0 commit comments

Comments
 (0)