Weijun-H commented on code in PR #5625:
URL: https://github.com/apache/arrow-datafusion/pull/5625#discussion_r1142767389


##########
datafusion/common/src/column.rs:
##########
@@ -112,12 +114,18 @@ impl Column {
 
     /// Serialize column into a quoted flat name string
     pub fn quoted_flat_name(&self) -> String {
-        // TODO: quote identifiers only when special characters present
-        // see: https://github.com/apache/arrow-datafusion/issues/5523
         match &self.relation {
             Some(r) => {
-                format!("{}.{}", r.to_quoted_string(), 
quote_identifier(&self.name))
+                let regexp = Regex::new(r"^[a-zA-Z][_a-zA-Z0-9]*$").unwrap();
+                let column_name = if regexp.is_match(&self.name) {
+                    self.name.clone()
+                } else {
+                    quote_identifier(&self.name)
+                };
+
+                format!("{}.{}", r.to_quoted_string(), column_name)

Review Comment:
   It is a good idea. I will open a new ticket for it.



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