You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "avantgardnerio (via GitHub)" <gi...@apache.org> on 2023/01/25 23:01:51 UTC
[GitHub] [arrow-datafusion] avantgardnerio commented on a diff in pull request #5069: Validate assignment target column existence for UPDATE statements
avantgardnerio commented on code in PR #5069:
URL: https://github.com/apache/arrow-datafusion/pull/5069#discussion_r1087270486
##########
datafusion/sql/src/statement.rs:
##########
@@ -670,19 +670,20 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
// Overwrite with assignment expressions
let mut planner_context = PlannerContext::new();
- let assign_map = assignments
+ let mut assign_map = assignments
.iter()
.map(|assign| {
let col_name: &Ident = assign
.id
.iter()
.last()
.ok_or(DataFusionError::Plan("Empty column id".to_string()))?;
+ // Validate that the assignment target column exists
+ table_schema.field_with_unqualified_name(&col_name.value)?;
Review Comment:
The logic change looks good to me. I defer to @andygrove and @alamb on adding the `rstest` dependency. Personally I think it's worth it as it appears to reduce test boilerplate and I'm not too worried about `dev-dependencies`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org