waynexia commented on issue #6853:
URL: 
https://github.com/apache/arrow-datafusion/issues/6853#issuecomment-1632476140

   > > Thus I propose to make `TableReference` as simple as possible and gather 
all those `to_lower_cases` and "quotes" before generating the very first 
`TableReference`.
   > 
   > Could you expand on this point a bit? My only concern is that if an 
identifier part contains a period `.` then the quotes would still be necessary 
in the output of `to_string()`, e.g. `catalog."data.base".table`
   
   I'm thinking of making this kind of logic agnostic to `TableReference`. 
I.e., if the protocol allows an identifier containing `.`, then it is 
`catalog.data.base.table`. If It doesn't, this special identifier can be 
wrapped in quotes in the protocol, and the table reference is 
`catalog."data.base".table`. Likewise the Aa case, if a protocol is 
case-insensitive, it can either `.to_lower_case()` before the `TableReference` 
or after the `TableReference`. And the `TableReference` itself doesn't care 
anything about special character or Aa case.
   
   Consequently, `TableReference` doesn't need to implement parse functions 
like `From<String>` because it don't know the protocol. I've searched the usage 
of `TableReference::from` and most of them are for testing (if I don't miss 
something). One exception is `expand_qualified_wildcard()`, but it also looks 
like a misuse to me -- construct reference directly from `Vec<Ident>` seems 
more appropriate
   
   
https://github.com/apache/arrow-datafusion/blob/388aa25b737ba6bf7f17c9af784b1e5ef6d487d6/datafusion/sql/src/select.rs#L367-L372
 


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

Reply via email to