This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new f2c0100a5a Qualify filter fields in the update plan (#7316)
f2c0100a5a is described below
commit f2c0100a5a10bf3ea166a1a590d94b8c9b6cf673
Author: Marko Grujic <[email protected]>
AuthorDate: Thu Aug 17 15:24:07 2023 +0200
Qualify filter fields in the update plan (#7316)
---
datafusion/sql/src/statement.rs | 5 ++++-
datafusion/sql/tests/sql_integration.rs | 6 +++---
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/datafusion/sql/src/statement.rs b/datafusion/sql/src/statement.rs
index 0f5dbb9ec0..c9a34bfaf2 100644
--- a/datafusion/sql/src/statement.rs
+++ b/datafusion/sql/src/statement.rs
@@ -895,7 +895,10 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
.schema_provider
.get_table_provider(table_name.clone())?;
let arrow_schema = (*provider.schema()).clone();
- let table_schema = Arc::new(DFSchema::try_from(arrow_schema)?);
+ let table_schema = Arc::new(DFSchema::try_from_qualified_schema(
+ table_name.clone(),
+ &arrow_schema,
+ )?);
let values = table_schema.fields().iter().map(|f| {
(
f.name().clone(),
diff --git a/datafusion/sql/tests/sql_integration.rs
b/datafusion/sql/tests/sql_integration.rs
index 53ffccbdb4..d46fbd65d8 100644
--- a/datafusion/sql/tests/sql_integration.rs
+++ b/datafusion/sql/tests/sql_integration.rs
@@ -415,7 +415,7 @@ fn plan_update() {
let plan = r#"
Dml: op=[Update] table=[person]
Projection: person.id AS id, person.first_name AS first_name, Utf8("Kay") AS
last_name, person.age AS age, person.state AS state, person.salary AS salary,
person.birth_date AS birth_date, person.😀 AS 😀
- Filter: id = Int64(1)
+ Filter: person.id = Int64(1)
TableScan: person
"#
.trim();
@@ -3874,7 +3874,7 @@ fn test_prepare_statement_update_infer() {
let expected_plan = r#"
Dml: op=[Update] table=[person]
Projection: person.id AS id, person.first_name AS first_name,
person.last_name AS last_name, $1 AS age, person.state AS state, person.salary
AS salary, person.birth_date AS birth_date, person.😀 AS 😀
- Filter: id = $2
+ Filter: person.id = $2
TableScan: person
"#
.trim();
@@ -3894,7 +3894,7 @@ Dml: op=[Update] table=[person]
let expected_plan = r#"
Dml: op=[Update] table=[person]
Projection: person.id AS id, person.first_name AS first_name,
person.last_name AS last_name, Int32(42) AS age, person.state AS state,
person.salary AS salary, person.birth_date AS birth_date, person.😀 AS 😀
- Filter: id = UInt32(1)
+ Filter: person.id = UInt32(1)
TableScan: person
"#
.trim();