[ https://issues.apache.org/jira/browse/SPARK-20964?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16408578#comment-16408578 ]
Frederick Reiss commented on SPARK-20964: ----------------------------------------- SQL2016 prohibits the use of reserved words in unquoted identifiers. See [http://jtc1sc32.org/doc/N2301-2350/32N2311T-text_for_ballot-CD_9075-2.pdf], page 176: _26) The case-normal form of <regular identifer> shall not be equal, according to the comparison rules in Subclause 8.2, “<comparison predicate>”, to any <reserved word> (with every letter that is a lower-case letter replaced by the corresponding upper-case letter or letters), treated as the repetition of a <character string literal> that specifes a <character set specifcation> of SQL_IDENTIFIER._ That said, strict enforcement of that rule will break existing queries every time a new reserved word is added. This factor in turn leads users to start quoting *every* identifier as a defensive measure. You end up with SQL like this: {{SELECT "R"."A", "S"."B"}} {{ FROM "MYSCHEMA"."R" as "R", "MYSCHEMA"."S" as "S"}} DB2 allows reserved words to be used unquoted; for example, {{SELECT * FROM SYSIBM.SYSTABLES WHERE, WHERE}} (see [https://www.ibm.com/support/knowledgecenter/en/SSEPEK_11.0.0/sqlref/src/tpc/db2z_reservedwords.html]), which lets users use a more literate form of SQL. > Make some keywords reserved along with the ANSI/SQL standard > ------------------------------------------------------------ > > Key: SPARK-20964 > URL: https://issues.apache.org/jira/browse/SPARK-20964 > Project: Spark > Issue Type: Improvement > Components: SQL > Affects Versions: 2.1.1 > Reporter: Takeshi Yamamuro > Priority: Minor > > The current Spark has many non-reserved words that are essentially reserved > in the ANSI/SQL standard > (http://developer.mimer.se/validator/sql-reserved-words.tml). > https://github.com/apache/spark/blob/master/sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4#L709 > This is because there are many datasources (for instance twitter4j) that > unfortunately use reserved keywords for column names (See [~hvanhovell]'s > comments: https://github.com/apache/spark/pull/18079#discussion_r118842186). > We might fix this issue in future major releases. -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org