Phoenix500526 commented on code in PR #26921:
URL: https://github.com/apache/datafusion/pull/26921#discussion_r4421270993


##########
datafusion/core/src/execution/context/csv.rs:
##########
@@ -120,4 +147,27 @@ mod tests {
 
         Ok(())
     }
+
+    #[tokio::test]
+    async fn test_register_csv_identifier_normalization() -> Result<()> {
+        let ctx = SessionContext::new();
+
+        // 1. String literal normalizes to lowercase: "Example" -> "example"
+        ctx.register_csv("Example", "tests/data/example.csv", 
CsvReadOptions::new())
+            .await?;
+        assert!(ctx.sql("SELECT * FROM Example").await.is_ok());
+        assert!(ctx.sql("SELECT * FROM example").await.is_ok());
+        assert!(ctx.sql(r#"SELECT * FROM "Example""#).await.is_err());
+
+        // 2. TableReference::bare preserves exact case
+        ctx.register_csv(
+            TableReference::bare("QuotedExample"),
+            "tests/data/example.csv",
+            CsvReadOptions::new(),
+        )
+        .await?;
+        assert!(ctx.sql(r#"SELECT * FROM "QuotedExample""#).await.is_ok());
+
+        Ok(())
+    }

Review Comment:
   We've already had 
[test_table_reference_from_str_normalizes](https://github.com/apache/datafusion/blob/d75fd7b8604284cd41ce01557043882d454bbb6d/datafusion/common/src/table_reference.rs#L359-L393)
 to cover that. We don't need to add another one. 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to