Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17655#discussion_r111852553
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala
 ---
    @@ -114,14 +114,14 @@ class SessionCatalog(
        * Format table name, taking into account case sensitivity.
        */
       protected[this] def formatTableName(name: String): String = {
    -    if (conf.caseSensitiveAnalysis) name else name.toLowerCase
    +    if (conf.caseSensitiveAnalysis) name else name.toLowerCase(Locale.ROOT)
    --- End diff --
    
    I don't think column names have such restrictions. Assuming 
https://github.com/apache/spark/pull/7165, it seems we support other characters 
in column names. I can provide several cases that data becomes column names as 
below:
    
    ```scala
    scala> Seq("아").toDF("a").groupBy("a").pivot("a").count().show()
    +---+---+
    |  a|  아|
    +---+---+
    |  아|  1|
    +---+---+
    ```
    
    ```scala
    scala> import org.apache.spark.sql.functions
    import org.apache.spark.sql.functions
    
    scala> spark.range(1).select(functions.lit("아")).show()
    +---+
    |  아|
    +---+
    |  아|
    +---+
    ```
    
    Seems parser does not allow such characters though.
    
    ```sql
    scala> sql("SELECT 아 FROM tbl")
    org.apache.spark.sql.catalyst.parser.ParseException:
    no viable alternative at input 'SELECT 아'(line 1, pos 7)
    
    == SQL ==
    SELECT 아 FROM tbl
    -------^^^
    
      at 
org.apache.spark.sql.catalyst.parser.ParseException.withCommand(ParseDriver.scala:210)
      at 
org.apache.spark.sql.catalyst.parser.AbstractSqlParser.parse(ParseDriver.scala:112)
      at 
org.apache.spark.sql.execution.SparkSqlParser.parse(SparkSqlParser.scala:48)
      at 
org.apache.spark.sql.catalyst.parser.AbstractSqlParser.parsePlan(ParseDriver.scala:66)
      at org.apache.spark.sql.SparkSession.sql(SparkSession.scala:622)
      ... 48 elided
    ```
    
    It seems we can still select
    
    ```scala
    scala> 
Seq("아").toDF("a").groupBy("a").pivot("a").count().createOrReplaceTempView("tbl")
    
    scala> sql("SELECT *FROM tbl").show()
    +---+---+
    |  a|  아|
    +---+---+
    |  아|  1|
    +---+---+
    ```
    
    If these were mistakenly supported, these should have the restrictions 
first.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to