This is an automated email from the ASF dual-hosted git repository.

xudong963 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new 8cd92ac96f fix: case-sensitive quoted identifiers in DELETE statements 
(#14584)
8cd92ac96f is described below

commit 8cd92ac96ff24d8f8e532a565833e62242972953
Author: Nelson Antunes <[email protected]>
AuthorDate: Wed Feb 12 10:02:07 2025 +0000

    fix: case-sensitive quoted identifiers in DELETE statements (#14584)
---
 datafusion/sql/src/statement.rs         |  8 ++------
 datafusion/sql/tests/sql_integration.rs | 13 +++++++++++++
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/datafusion/sql/src/statement.rs b/datafusion/sql/src/statement.rs
index eed39be575..209e9cc787 100644
--- a/datafusion/sql/src/statement.rs
+++ b/datafusion/sql/src/statement.rs
@@ -1711,12 +1711,8 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
         let table_source = 
self.context_provider.get_table_source(table_ref.clone())?;
         let schema = (*table_source.schema()).clone();
         let schema = DFSchema::try_from(schema)?;
-        let scan = LogicalPlanBuilder::scan(
-            object_name_to_string(&table_name),
-            table_source,
-            None,
-        )?
-        .build()?;
+        let scan =
+            LogicalPlanBuilder::scan(table_ref.clone(), table_source, 
None)?.build()?;
         let mut planner_context = PlannerContext::new();
 
         let source = match predicate_expr {
diff --git a/datafusion/sql/tests/sql_integration.rs 
b/datafusion/sql/tests/sql_integration.rs
index 5f460eb94a..b92bc0fd60 100644
--- a/datafusion/sql/tests/sql_integration.rs
+++ b/datafusion/sql/tests/sql_integration.rs
@@ -555,6 +555,19 @@ Dml: op=[Delete] table=[person]
     quick_test(sql, plan);
 }
 
+#[test]
+fn plan_delete_quoted_identifier_case_sensitive() {
+    let sql =
+        "DELETE FROM \"SomeCatalog\".\"SomeSchema\".\"UPPERCASE_test\" WHERE 
\"Id\" = 1";
+    let plan = r#"
+Dml: op=[Delete] table=[SomeCatalog.SomeSchema.UPPERCASE_test]
+  Filter: Id = Int64(1)
+    TableScan: SomeCatalog.SomeSchema.UPPERCASE_test
+    "#
+    .trim();
+    quick_test(sql, plan);
+}
+
 #[test]
 fn select_column_does_not_exist() {
     let sql = "SELECT doesnotexist FROM person";


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to