Uh oh!
There was an error while loading. Please reload this page.
[SPARK-28349][SQL] Add FALSE and SETMINUS to ansiNonReserved - #25114
[SPARK-28349][SQL] Add FALSE and SETMINUS to ansiNonReserved#25114wangyum wants to merge 1 commit into
Conversation
SparkQA
commented
Jul 11, 2019
Test build #107530 has finished for PR 25114 at commit
|
wangyum
commented
Jul 11, 2019
maropu
commented
Jul 11, 2019
Is this correct? I don't check carefully check yet, but I think the 'reserved' meaning is essentially different between spark and the other systems. For example, these keyworkds below are reserved in postgresql, but they can be used as alias names; |
gatorsmile
commented
Jul 12, 2019
First, FALSE is reserved word. Second, see https://www.postgresql.org/docs/7.3/sql-keywords-appendix.html
We do not need to follow PostgreSQL to support reserved words in column alias. |
wangyum
commented
Jul 13, 2019
Thank you @gatorsmile |
wangyum
commented
Jul 17, 2019
spark-sql>setspark.sql.parser.ansi.enabled=true;
spark.sql.parser.ansi.enabled true
spark-sql>select extract(year fromtimestamp'2001-02-16 20:38:40') ;
Error in query:
no viable alternative at input 'year'(line1, pos 15)
== SQL ==select extract(year fromtimestamp'2001-02-16 20:38:40')
---------------^^^
spark-sql>setspark.sql.parser.ansi.enabled=false;
spark.sql.parser.ansi.enabled false
spark-sql>select extract(year fromtimestamp'2001-02-16 20:38:40') ;
2001Do we need to add |
maropu
commented
Jul 19, 2019
I think we don't need to do so cuz we basically follow SQL-2011 now. |
wangyum
commented
Jul 19, 2019
or add a regular_id? Some UDFs are also not available in ansi mode: spark-sql>select left('12345', 2);
12
spark-sql>setspark.sql.parser.ansi.enabled=true;
spark.sql.parser.ansi.enabled true
spark-sql>select left('12345', 2);
Error in query:
no viable alternative at input 'left'(line1, pos 7)
== SQL ==select left('12345', 2)
-------^^^ |
maropu
commented
Jul 19, 2019
Rather, itd be better to list up these functions and rename them if necessary? IMO making these keywords non-reserved worsens parser error messages... |
What changes were proposed in this pull request?
How to reproduce this issue:
Other databases behaviour:
PostgreSQL:
Vertica:
SQL Server:
DB2:

Oracle:
Teradata:

This pr add
FALSEandSETMINUSto ansiNonReserved to fix this issue.How was this patch tested?
unit tests and manual tests: