[jira] [Updated] (SPARK-27060) DDL Commands are accepting Keywords like create, drop as tableName

2019-03-07 Thread Hyukjin Kwon (JIRA)


 [ 
https://issues.apache.org/jira/browse/SPARK-27060?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hyukjin Kwon updated SPARK-27060:
-
Description: 
Seems to be a compatibility issue compared to other components such as hive and 
mySql. 
DDL commands are successful even though the tableName is same as keyword. 

Tested with columnNames as well and issue exists. 

Whereas, Hive-Beeline is throwing ParseException and not accepting keywords as 
tableName or columnName and mySql is accepting keywords only as columnName.


Spark-Behaviour :

{code}
Connected to: Spark SQL (version 2.3.2.0101)
CLI_DBMS_APPID
Beeline version 1.2.1.spark_2.3.2.0101 by Apache Hive
0: jdbc:hive2://10.18.3.XXX:23040/default> create table create(id int);
+-+--+
| Result  |
+-+--+
+-+--+
No rows selected (0.255 seconds)
0: jdbc:hive2://10.18.3.XXX:23040/default> create table drop(int int);
+-+--+
| Result  |
+-+--+
+-+--+
No rows selected (0.257 seconds)
0: jdbc:hive2://10.18.3.XXX:23040/default> drop table drop;
+-+--+
| Result  |
+-+--+
+-+--+
No rows selected (0.236 seconds)
0: jdbc:hive2://10.18.3.XXX:23040/default> drop table create;
+-+--+
| Result  |
+-+--+
+-+--+
No rows selected (0.168 seconds)
0: jdbc:hive2://10.18.3.XXX:23040/default> create table tab1(float float);
+-+--+
| Result  |
+-+--+
+-+--+
No rows selected (0.111 seconds)
0: jdbc:hive2://10.18.XXX:23040/default> create table double(double float);
+-+--+
| Result  |
+-+--+
+-+--+
No rows selected (0.093 seconds)
{code}



Hive-Behaviour :

{code}
Connected to: Apache Hive (version 3.1.0)
Driver: Hive JDBC (version 3.1.0)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 3.1.0 by Apache Hive

0: jdbc:hive2://10.18.XXX:21066/> create table create(id int);
Error: Error while compiling statement: FAILED: ParseException line 1:13 cannot 
recognize input near 'create' '(' 'id' in table name (state=42000,code=4)

0: jdbc:hive2://10.18.XXX:21066/> create table drop(id int);
Error: Error while compiling statement: FAILED: ParseException line 1:13 cannot 
recognize input near 'drop' '(' 'id' in table name (state=42000,code=4)

0: jdbc:hive2://10.18XXX:21066/> create table tab1(float float);
Error: Error while compiling statement: FAILED: ParseException line 1:18 cannot 
recognize input near 'float' 'float' ')' in column name or constraint 
(state=42000,code=4)

0: jdbc:hive2://10.18XXX:21066/> drop table create(id int);
Error: Error while compiling statement: FAILED: ParseException line 1:11 cannot 
recognize input near 'create' '(' 'id' in table name (state=42000,code=4)

0: jdbc:hive2://10.18.XXX:21066/> drop table drop(id int);
Error: Error while compiling statement: FAILED: ParseException line 1:11 cannot 
recognize input near 'drop' '(' 'id' in table name (state=42000,code=4)

mySql :
CREATE TABLE CREATE(ID integer);
Error: near "CREATE": syntax error

CREATE TABLE DROP(ID integer);
Error: near "DROP": syntax error

CREATE TABLE TAB1(FLOAT FLOAT);
Success
{code}







  was:
Seems to be a compatibility issue compared to other components such as hive and 
mySql. 
DDL commands are successful even though the tableName is same as keyword. 

Tested with columnNames as well and issue exists. 

Whereas, Hive-Beeline is throwing ParseException and not accepting keywords as 
tableName or columnName and mySql is accepting keywords only as columnName.


Spark-Behaviour :

Connected to: Spark SQL (version 2.3.2.0101)
CLI_DBMS_APPID
Beeline version 1.2.1.spark_2.3.2.0101 by Apache Hive
0: jdbc:hive2://10.18.3.XXX:23040/default> create table create(id int);
+-+--+
| Result  |
+-+--+
+-+--+
No rows selected (0.255 seconds)
0: jdbc:hive2://10.18.3.XXX:23040/default> create table drop(int int);
+-+--+
| Result  |
+-+--+
+-+--+
No rows selected (0.257 seconds)
0: jdbc:hive2://10.18.3.XXX:23040/default> drop table drop;
+-+--+
| Result  |
+-+--+
+-+--+
No rows selected (0.236 seconds)
0: jdbc:hive2://10.18.3.XXX:23040/default> drop table create;
+-+--+
| Result  |
+-+--+
+-+--+
No rows selected (0.168 seconds)
0: jdbc:hive2://10.18.3.XXX:23040/default> create table tab1(float float);
+-+--+
| Result  |
+-+--+
+-+--+
No rows selected (0.111 seconds)
0: jdbc:hive2://10.18.XXX:23040/default> create table double(double float);
+-+--+
| Result  |
+-+--+
+-+--+
No rows selected (0.093 seconds)



Hive-Behaviour :

Connected to: Apache Hive (version 3.1.0)
Driver: Hive JDBC (version 3.1.0)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 3.1.0 by Apache Hive

0: jdbc:hive2://10.18.XXX:21066/> create table create(id int);
Error: Error while compiling statement: FAILED: ParseException line 1:13 

[jira] [Updated] (SPARK-27060) DDL Commands are accepting Keywords like create, drop as tableName

2019-03-05 Thread Sean Owen (JIRA)


 [ 
https://issues.apache.org/jira/browse/SPARK-27060?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sean Owen updated SPARK-27060:
--
Target Version/s:   (was: 2.4.0)
Priority: Minor  (was: Major)
   Fix Version/s: (was: 2.3.2)
  (was: 2.4.0)

Don't set Fix or Target Version.
This isn't my area, but I agree it seems surprising if you can create a table 
called "CREATE".
Please post your Spark reproduction and version though.

> DDL Commands are accepting Keywords like create, drop as tableName
> --
>
> Key: SPARK-27060
> URL: https://issues.apache.org/jira/browse/SPARK-27060
> Project: Spark
>  Issue Type: Improvement
>  Components: SQL
>Affects Versions: 2.3.2, 2.4.0
>Reporter: Sachin Ramachandra Setty
>Priority: Minor
>
> Seems to be a compatibility issue compared to other components such as hive 
> and mySql. 
> DDL commands are successful even though the tableName is same as keyword. 
> Tested with columnNames as well and issue exists. 
> Whereas, Hive-Beeline is throwing ParseException and not accepting keywords 
> as tableName or columnName and mySql is accepting keywords only as columnName.
> Spark-Behaviour :
> Connected to: Spark SQL (version 2.3.2.0101)
> CLI_DBMS_APPID
> Beeline version 1.2.1.spark_2.3.2.0101 by Apache Hive
> 0: jdbc:hive2://10.18.3.XXX:23040/default> create table create(id int);
> +-+--+
> | Result  |
> +-+--+
> +-+--+
> No rows selected (0.255 seconds)
> 0: jdbc:hive2://10.18.3.XXX:23040/default> create table drop(int int);
> +-+--+
> | Result  |
> +-+--+
> +-+--+
> No rows selected (0.257 seconds)
> 0: jdbc:hive2://10.18.3.XXX:23040/default> drop table drop;
> +-+--+
> | Result  |
> +-+--+
> +-+--+
> No rows selected (0.236 seconds)
> 0: jdbc:hive2://10.18.3.XXX:23040/default> drop table create;
> +-+--+
> | Result  |
> +-+--+
> +-+--+
> No rows selected (0.168 seconds)
> 0: jdbc:hive2://10.18.3.XXX:23040/default> create table tab1(float float);
> +-+--+
> | Result  |
> +-+--+
> +-+--+
> No rows selected (0.111 seconds)
> 0: jdbc:hive2://10.18.XXX:23040/default> create table double(double float);
> +-+--+
> | Result  |
> +-+--+
> +-+--+
> No rows selected (0.093 seconds)
> Hive-Behaviour :
> Connected to: Apache Hive (version 3.1.0)
> Driver: Hive JDBC (version 3.1.0)
> Transaction isolation: TRANSACTION_REPEATABLE_READ
> Beeline version 3.1.0 by Apache Hive
> 0: jdbc:hive2://10.18.XXX:21066/> create table create(id int);
> Error: Error while compiling statement: FAILED: ParseException line 1:13 
> cannot recognize input near 'create' '(' 'id' in table name 
> (state=42000,code=4)
> 0: jdbc:hive2://10.18.XXX:21066/> create table drop(id int);
> Error: Error while compiling statement: FAILED: ParseException line 1:13 
> cannot recognize input near 'drop' '(' 'id' in table name 
> (state=42000,code=4)
> 0: jdbc:hive2://10.18XXX:21066/> create table tab1(float float);
> Error: Error while compiling statement: FAILED: ParseException line 1:18 
> cannot recognize input near 'float' 'float' ')' in column name or constraint 
> (state=42000,code=4)
> 0: jdbc:hive2://10.18XXX:21066/> drop table create(id int);
> Error: Error while compiling statement: FAILED: ParseException line 1:11 
> cannot recognize input near 'create' '(' 'id' in table name 
> (state=42000,code=4)
> 0: jdbc:hive2://10.18.XXX:21066/> drop table drop(id int);
> Error: Error while compiling statement: FAILED: ParseException line 1:11 
> cannot recognize input near 'drop' '(' 'id' in table name 
> (state=42000,code=4)
> mySql :
> CREATE TABLE CREATE(ID integer);
> Error: near "CREATE": syntax error
> CREATE TABLE DROP(ID integer);
> Error: near "DROP": syntax error
> CREATE TABLE TAB1(FLOAT FLOAT);
> Success



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