Github user maropu commented on the issue:

    https://github.com/apache/spark/pull/17191
  
    @gatorsmile I checked and actually MySQL and PostgreSQL cannnot use numbers 
as alias names;
    
    ```
    // PostgreSQL
    postgres=# SELECT gkey1 AS 1 FROM t2;
    ERROR:  syntax error at or near "1"
    LINE 1: SELECT gkey1 AS 1 FROM t2;
    
    // MySQL
    mysql> select gkey1 AS 1 from t2;
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual 
that corresponds to your MySQL server version for the right syntax to use near 
'1 from t2' at line 1
    mysql> 
    ```
    
    In current master, spark have the same behaviour; the parser throws an 
exception in the case; 
    ```
    scala> sql("SELECT key1 AS 1 FROM t").show
    org.apache.spark.sql.catalyst.parser.ParseException:
    extraneous input '1' expecting {<EOF>, ',', 'FROM', 'WHERE', 'GROUP', 
'ORDER', 'HAVING', 'LIMIT', 'LATERAL', 'WINDOW', 'UNION', 'EXCEPT', 'MINUS', 
'INTERSECT', 'SORT', 'CLUSTER', 'DISTRIBUTE'}(line 1, pos 15)
    
    == SQL ==
    SELECT key1 AS 1 FROM t
    ---------------^^^
    
      at 
org.apache.spark.sql.catalyst.parser.ParseException.withCommand(ParseDriver.scala:205)
    ```


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