You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/04/18 19:24:40 UTC

[GitHub] [arrow-datafusion] Dandandan commented on a diff in pull request #2267: trim quoted table name in `FROM` clause when creating relation

Dandandan commented on code in PR #2267:
URL: https://github.com/apache/arrow-datafusion/pull/2267#discussion_r852351865


##########
datafusion/core/src/sql/planner.rs:
##########
@@ -638,7 +638,8 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
             TableFactor::Table {
                 ref name, alias, ..
             } => {
-                let table_name = name.to_string();
+                // Trim quoted table name: "db_name" -> db_name
+                let table_name = name.to_string().trim_matches('\"').to_string();

Review Comment:
   
   `trim_matches` also trims double, triple, etc. quotes. and doesn't care about symmetry (one start quote should be ended by one enrd quote).
   
   I believe we should handle (to support quotes table name) the parsing at the sqlparser library:
   
   https://github.com/sqlparser-rs/sqlparser-rs



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