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


##########
datafusion/core/src/execution/context/csv.rs:
##########
@@ -45,8 +45,35 @@ impl SessionContext {
         self._read_type(table_paths, options).await
     }
 
-    /// Registers a CSV file as a table which can referenced from SQL
+    /// Registers a CSV file as a table which can be referenced from SQL
     /// statements executed against this context.
+    ///
+    /// Table names passed as strings (e.g. `"Example"`) are parsed as
+    /// unquoted SQL identifiers and normalized to lowercase. To preserve
+    /// exact casing and match case-sensitive quoted queries like
+    /// `SELECT * FROM "Example"`, use [`TableReference::bare`].

Review Comment:
   Consider mentioning `TableReference::partial("sales", "Example")` for 
qualified names. `TableReference::bare("sales.Example")` treats the dot as part 
of the table name.



##########
datafusion/core/src/execution/context/csv.rs:
##########
@@ -45,8 +45,35 @@ impl SessionContext {
         self._read_type(table_paths, options).await
     }
 
-    /// Registers a CSV file as a table which can referenced from SQL
+    /// Registers a CSV file as a table which can be referenced from SQL
     /// statements executed against this context.
+    ///
+    /// Table names passed as strings (e.g. `"Example"`) are parsed as

Review Comment:
   Strings are parsed as SQL identifiers, not necessarily unquoted names. 
Please clarify that dots separate components, unquoted components are 
lowercased, and quoted components preserve case. Keep `TableReference::bare` 
for literal, unqualified names.



##########
datafusion/core/src/execution/context/csv.rs:
##########
@@ -45,8 +45,35 @@ impl SessionContext {
         self._read_type(table_paths, options).await
     }
 
-    /// Registers a CSV file as a table which can referenced from SQL
+    /// Registers a CSV file as a table which can be referenced from SQL
     /// statements executed against this context.
+    ///
+    /// Table names passed as strings (e.g. `"Example"`) are parsed as
+    /// unquoted SQL identifiers and normalized to lowercase. To preserve
+    /// exact casing and match case-sensitive quoted queries like
+    /// `SELECT * FROM "Example"`, use [`TableReference::bare`].
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// use datafusion::prelude::*;
+    /// use datafusion::common::TableReference;
+    /// # use datafusion::error::Result;
+    /// # #[tokio::main]
+    /// # async fn main() -> Result<()> {
+    /// let ctx = SessionContext::new();
+    ///
+    /// ctx.register_csv(
+    ///     TableReference::bare("Example"),
+    ///     "tests/data/example.csv",
+    ///     CsvReadOptions::new(),
+    /// )
+    /// .await?;
+    ///
+    /// let df = ctx.sql(r#"SELECT * FROM "Example""#).await?;

Review Comment:
   Consider adding a hidden `# #[cfg(feature = "sql")]` before `ctx.sql(...)`. 
The doctest currently fails with `E0599` under `--no-default-features` because 
`SessionContext::sql` is unavailable.



-- 
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