[jira] [Commented] (SPARK-17857) SHOW TABLES IN schema throws exception if schema doesn't exist

2016-10-10 Thread Todd Nemet (JIRA)

[ 
https://issues.apache.org/jira/browse/SPARK-17857?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15563877#comment-15563877
 ] 

Todd Nemet commented on SPARK-17857:


I didn't even think to check Hive 1.2, since I figured it would have the same 
behavior as Spark 1.5 and 1.6. I'm really surprised by that.

For context, due to 
[SPARK-9686|https://issues.apache.org/jira/browse/SPARK-9686] we use SHOW and 
DESCRIBE to walk the schema in Spark instead of connection.getMetaData(), like 
we do in Hive and Impala.

We are catching the exception to workaround it, but since it's a change from 
1.x I thought I'd file it as a minor bug. But since it's not a difference from 
Hive perhaps it's not a bug.



> SHOW TABLES IN schema throws exception if schema doesn't exist
> --
>
> Key: SPARK-17857
> URL: https://issues.apache.org/jira/browse/SPARK-17857
> Project: Spark
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 2.0.0, 2.0.1
>Reporter: Todd Nemet
>Priority: Minor
>
> SHOW TABLES IN badschema; throws 
> org.apache.spark.sql.catalyst.analysis.NoSuchDatabaseException if badschema 
> doesn't exist. In Spark 1.x it would return an empty result set.
> On Spark 2.0.1:
> {code}
> [683|12:45:56] ~/Documents/spark/spark$ bin/beeline -u 
> jdbc:hive2://localhost:10006/ -n hive
> Connecting to jdbc:hive2://localhost:10006/
> 16/10/10 12:46:00 INFO jdbc.Utils: Supplied authorities: localhost:10006
> 16/10/10 12:46:00 INFO jdbc.Utils: Resolved authority: localhost:10006
> 16/10/10 12:46:00 INFO jdbc.HiveConnection: Will try to open client transport 
> with JDBC Uri: jdbc:hive2://localhost:10006/
> Connected to: Spark SQL (version 2.0.1)
> Driver: Hive JDBC (version 1.2.1.spark2)
> Transaction isolation: TRANSACTION_REPEATABLE_READ
> Beeline version 1.2.1.spark2 by Apache Hive
> 0: jdbc:hive2://localhost:10006/> show schemas;
> +---+--+
> | databaseName  |
> +---+--+
> | default   |
> | looker_scratch|
> | spark_jira|
> | spark_looker_scratch  |
> | spark_looker_test |
> +---+--+
> 5 rows selected (0.61 seconds)
> 0: jdbc:hive2://localhost:10006/> show tables in spark_looker_test;
> +--+--+--+
> |  tableName   | isTemporary  |
> +--+--+--+
> | all_types| false|
> | order_items  | false|
> | orders   | false|
> | users| false|
> +--+--+--+
> 4 rows selected (0.611 seconds)
> 0: jdbc:hive2://localhost:10006/> show tables in badschema;
> Error: org.apache.spark.sql.catalyst.analysis.NoSuchDatabaseException: 
> Database 'badschema' not found; (state=,code=0)
> {code}
> On Spark 1.6.2:
> {code}
> [680|12:47:26] ~/Documents/spark/spark$ bin/beeline -u 
> jdbc:hive2://localhost:10005/ -n hive
> Connecting to jdbc:hive2://localhost:10005/
> 16/10/10 12:47:29 INFO jdbc.Utils: Supplied authorities: localhost:10005
> 16/10/10 12:47:29 INFO jdbc.Utils: Resolved authority: localhost:10005
> 16/10/10 12:47:30 INFO jdbc.HiveConnection: Will try to open client transport 
> with JDBC Uri: jdbc:hive2://localhost:10005/
> Connected to: Spark SQL (version 1.6.2)
> Driver: Hive JDBC (version 1.2.1.spark2)
> Transaction isolation: TRANSACTION_REPEATABLE_READ
> Beeline version 1.2.1.spark2 by Apache Hive
> 0: jdbc:hive2://localhost:10005/> show schemas;
> ++--+
> |   result   |
> ++--+
> | default|
> | spark_jira |
> | spark_looker_test  |
> | spark_scratch  |
> ++--+
> 4 rows selected (0.613 seconds)
> 0: jdbc:hive2://localhost:10005/> show tables in spark_looker_test;
> +--+--+--+
> |  tableName   | isTemporary  |
> +--+--+--+
> | all_types| false|
> | order_items  | false|
> | orders   | false|
> | users| false|
> +--+--+--+
> 4 rows selected (0.575 seconds)
> 0: jdbc:hive2://localhost:10005/> show tables in badschema;
> ++--+--+
> | tableName  | isTemporary  |
> ++--+--+
> ++--+--+
> No rows selected (0.458 seconds)
> {code}
> [Relevant part of Hive QL 
> docs|https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-ShowTables]



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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



[jira] [Created] (SPARK-17857) SHOW TABLES IN schema throws exception if schema doesn't exist

2016-10-10 Thread Todd Nemet (JIRA)
Todd Nemet created SPARK-17857:
--

 Summary: SHOW TABLES IN schema throws exception if schema doesn't 
exist
 Key: SPARK-17857
 URL: https://issues.apache.org/jira/browse/SPARK-17857
 Project: Spark
  Issue Type: Bug
  Components: SQL
Affects Versions: 2.0.1, 2.0.0
Reporter: Todd Nemet
Priority: Minor


SHOW TABLES IN badschema; throws 
org.apache.spark.sql.catalyst.analysis.NoSuchDatabaseException if badschema 
doesn't exist. In Spark 1.x it would return an empty result set.

On Spark 2.0.1:

{code}
[683|12:45:56] ~/Documents/spark/spark$ bin/beeline -u 
jdbc:hive2://localhost:10006/ -n hive
Connecting to jdbc:hive2://localhost:10006/
16/10/10 12:46:00 INFO jdbc.Utils: Supplied authorities: localhost:10006
16/10/10 12:46:00 INFO jdbc.Utils: Resolved authority: localhost:10006
16/10/10 12:46:00 INFO jdbc.HiveConnection: Will try to open client transport 
with JDBC Uri: jdbc:hive2://localhost:10006/
Connected to: Spark SQL (version 2.0.1)
Driver: Hive JDBC (version 1.2.1.spark2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 1.2.1.spark2 by Apache Hive
0: jdbc:hive2://localhost:10006/> show schemas;
+---+--+
| databaseName  |
+---+--+
| default   |
| looker_scratch|
| spark_jira|
| spark_looker_scratch  |
| spark_looker_test |
+---+--+
5 rows selected (0.61 seconds)
0: jdbc:hive2://localhost:10006/> show tables in spark_looker_test;
+--+--+--+
|  tableName   | isTemporary  |
+--+--+--+
| all_types| false|
| order_items  | false|
| orders   | false|
| users| false|
+--+--+--+
4 rows selected (0.611 seconds)
0: jdbc:hive2://localhost:10006/> show tables in badschema;
Error: org.apache.spark.sql.catalyst.analysis.NoSuchDatabaseException: Database 
'badschema' not found; (state=,code=0)
{code}

On Spark 1.6.2:

{code}
[680|12:47:26] ~/Documents/spark/spark$ bin/beeline -u 
jdbc:hive2://localhost:10005/ -n hive
Connecting to jdbc:hive2://localhost:10005/
16/10/10 12:47:29 INFO jdbc.Utils: Supplied authorities: localhost:10005
16/10/10 12:47:29 INFO jdbc.Utils: Resolved authority: localhost:10005
16/10/10 12:47:30 INFO jdbc.HiveConnection: Will try to open client transport 
with JDBC Uri: jdbc:hive2://localhost:10005/
Connected to: Spark SQL (version 1.6.2)
Driver: Hive JDBC (version 1.2.1.spark2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 1.2.1.spark2 by Apache Hive
0: jdbc:hive2://localhost:10005/> show schemas;
++--+
|   result   |
++--+
| default|
| spark_jira |
| spark_looker_test  |
| spark_scratch  |
++--+
4 rows selected (0.613 seconds)
0: jdbc:hive2://localhost:10005/> show tables in spark_looker_test;
+--+--+--+
|  tableName   | isTemporary  |
+--+--+--+
| all_types| false|
| order_items  | false|
| orders   | false|
| users| false|
+--+--+--+
4 rows selected (0.575 seconds)
0: jdbc:hive2://localhost:10005/> show tables in badschema;
++--+--+
| tableName  | isTemporary  |
++--+--+
++--+--+
No rows selected (0.458 seconds)
{code}

[Relevant part of Hive QL 
docs|https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-ShowTables]




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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



[jira] [Updated] (SPARK-17818) Cannot SELECT NULL

2016-10-06 Thread Todd Nemet (JIRA)

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

Todd Nemet updated SPARK-17818:
---
Description: 
When connecting to Spark SQL via JDBC/thriftserver, running `SELECT NULL` 
returns this error:

{code}
0: jdbc:hive2://localhost:10016/> select NULL;
Error: java.lang.IllegalArgumentException: Unrecognized type name: null 
(state=,code=0)
{code}

_Note: I originally pasted in this code erroneously:_
{code}
0: jdbc:hive2://localhost:10016/> select cast(NULL as NULL);
Error: org.apache.spark.sql.catalyst.parser.ParseException: 
DataType null() is not supported.(line 1, pos 20)
{code}


This is a regression from Spark 1.x/Hive QL compatibility. In Spark 1.5.2, The 
same query returns NULL:

{code}
0: jdbc:hive2://localhost:10015/> select null;
+---+--+
|  _c0  |
+---+--+
| NULL  |
+---+--+
1 row selected (0.658 seconds)
{code}

I can select expressions that evaluate to NULL or CAST NULL to different types:
{code}
0: jdbc:hive2://localhost:10016/> select null=null
0: jdbc:hive2://localhost:10016/> ;
++--+
| (NULL = NULL)  |
++--+
| NULL   |
++--+
1 row selected (0.69 seconds)
0: jdbc:hive2://localhost:10016/> select cast (NULL as int);
++--+
| CAST(NULL AS INT)  |
++--+
| NULL   |
++--+
1 row selected (0.676 seconds)
0: jdbc:hive2://localhost:10016/> select cast (NULL as string);
+---+--+
| CAST(NULL AS STRING)  |
+---+--+
| NULL  |
+---+--+
{code}


  was:
When connecting to Spark SQL via JDBC/thriftserver, running `SELECT NULL` 
returns this error:

{code}
0: jdbc:hive2://localhost:10016/> select cast(NULL as NULL);
Error: org.apache.spark.sql.catalyst.parser.ParseException: 
DataType null() is not supported.(line 1, pos 20)
{code}

This is a regression from Spark 1.x/Hive QL compatibility. In Spark 1.5.2, The 
same query returns NULL:

{code}
0: jdbc:hive2://localhost:10015/> select null;
+---+--+
|  _c0  |
+---+--+
| NULL  |
+---+--+
1 row selected (0.658 seconds)
{code}

I can select expressions that evaluate to NULL or CAST NULL to different types:
{code}
0: jdbc:hive2://localhost:10016/> select null=null
0: jdbc:hive2://localhost:10016/> ;
++--+
| (NULL = NULL)  |
++--+
| NULL   |
++--+
1 row selected (0.69 seconds)
0: jdbc:hive2://localhost:10016/> select cast (NULL as int);
++--+
| CAST(NULL AS INT)  |
++--+
| NULL   |
++--+
1 row selected (0.676 seconds)
0: jdbc:hive2://localhost:10016/> select cast (NULL as string);
+---+--+
| CAST(NULL AS STRING)  |
+---+--+
| NULL  |
+---+--+
{code}



> Cannot SELECT NULL
> --
>
> Key: SPARK-17818
> URL: https://issues.apache.org/jira/browse/SPARK-17818
> Project: Spark
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 2.0.0, 2.0.1
>Reporter: Todd Nemet
> Fix For: 2.0.2
>
>
> When connecting to Spark SQL via JDBC/thriftserver, running `SELECT NULL` 
> returns this error:
> {code}
> 0: jdbc:hive2://localhost:10016/> select NULL;
> Error: java.lang.IllegalArgumentException: Unrecognized type name: null 
> (state=,code=0)
> {code}
> _Note: I originally pasted in this code erroneously:_
> {code}
> 0: jdbc:hive2://localhost:10016/> select cast(NULL as NULL);
> Error: org.apache.spark.sql.catalyst.parser.ParseException: 
> DataType null() is not supported.(line 1, pos 20)
> {code}
> This is a regression from Spark 1.x/Hive QL compatibility. In Spark 1.5.2, 
> The same query returns NULL:
> {code}
> 0: jdbc:hive2://localhost:10015/> select null;
> +---+--+
> |  _c0  |
> +---+--+
> | NULL  |
> +---+--+
> 1 row selected (0.658 seconds)
> {code}
> I can select expressions that evaluate to NULL or CAST NULL to different 
> types:
> {code}
> 0: jdbc:hive2://localhost:10016/> select null=null
> 0: jdbc:hive2://localhost:10016/> ;
> ++--+
> | (NULL = NULL)  |
> ++--+
> | NULL   |
> ++--+
> 1 row selected (0.69 seconds)
> 0: jdbc:hive2://localhost:10016/> select cast (NULL as int);
> ++--+
> | CAST(NULL AS INT)  |
> ++--+
> | NULL   |
> ++--+
> 1 row selected (0.676 seconds)
> 0: jdbc:hive2://localhost:10016/> select cast (NULL as string);
> +---+--+
> | CAST(NULL AS STRING)  |
> +---+--+
> | NULL  |
> +---+--+
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---

[jira] [Commented] (SPARK-17818) Cannot SELECT NULL

2016-10-06 Thread Todd Nemet (JIRA)

[ 
https://issues.apache.org/jira/browse/SPARK-17818?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15553989#comment-15553989
 ] 

Todd Nemet commented on SPARK-17818:


Oh man, you are right. I cut and pasted and wrong part of my terminal session. 
I meant to put this in:

{code}
0: jdbc:hive2://localhost:10016/> select NULL;
Error: java.lang.IllegalArgumentException: Unrecognized type name: null 
(state=,code=0)
{code}

No biggie, just the entire point of the JIRA...

> Cannot SELECT NULL
> --
>
> Key: SPARK-17818
> URL: https://issues.apache.org/jira/browse/SPARK-17818
> Project: Spark
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 2.0.0, 2.0.1
>Reporter: Todd Nemet
> Fix For: 2.0.2
>
>
> When connecting to Spark SQL via JDBC/thriftserver, running `SELECT NULL` 
> returns this error:
> {code}
> 0: jdbc:hive2://localhost:10016/> select cast(NULL as NULL);
> Error: org.apache.spark.sql.catalyst.parser.ParseException: 
> DataType null() is not supported.(line 1, pos 20)
> {code}
> This is a regression from Spark 1.x/Hive QL compatibility. In Spark 1.5.2, 
> The same query returns NULL:
> {code}
> 0: jdbc:hive2://localhost:10015/> select null;
> +---+--+
> |  _c0  |
> +---+--+
> | NULL  |
> +---+--+
> 1 row selected (0.658 seconds)
> {code}
> I can select expressions that evaluate to NULL or CAST NULL to different 
> types:
> {code}
> 0: jdbc:hive2://localhost:10016/> select null=null
> 0: jdbc:hive2://localhost:10016/> ;
> ++--+
> | (NULL = NULL)  |
> ++--+
> | NULL   |
> ++--+
> 1 row selected (0.69 seconds)
> 0: jdbc:hive2://localhost:10016/> select cast (NULL as int);
> ++--+
> | CAST(NULL AS INT)  |
> ++--+
> | NULL   |
> ++--+
> 1 row selected (0.676 seconds)
> 0: jdbc:hive2://localhost:10016/> select cast (NULL as string);
> +---+--+
> | CAST(NULL AS STRING)  |
> +---+--+
> | NULL  |
> +---+--+
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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



[jira] [Commented] (SPARK-17818) Cannot SELECT NULL

2016-10-06 Thread Todd Nemet (JIRA)

[ 
https://issues.apache.org/jira/browse/SPARK-17818?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15553792#comment-15553792
 ] 

Todd Nemet commented on SPARK-17818:


I'm referring to your example above of
  SELECT CAST(NULL AS NULL)
which I don't believe is valid SQL.
  SELECT NULL
definitely is, and that's what needs to work.

I cast NULL as an INT and a STRING, but not a NULL. Again, thanks for the help.


> Cannot SELECT NULL
> --
>
> Key: SPARK-17818
> URL: https://issues.apache.org/jira/browse/SPARK-17818
> Project: Spark
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 2.0.0, 2.0.1
>Reporter: Todd Nemet
> Fix For: 2.0.2
>
>
> When connecting to Spark SQL via JDBC/thriftserver, running `SELECT NULL` 
> returns this error:
> {code}
> 0: jdbc:hive2://localhost:10016/> select cast(NULL as NULL);
> Error: org.apache.spark.sql.catalyst.parser.ParseException: 
> DataType null() is not supported.(line 1, pos 20)
> {code}
> This is a regression from Spark 1.x/Hive QL compatibility. In Spark 1.5.2, 
> The same query returns NULL:
> {code}
> 0: jdbc:hive2://localhost:10015/> select null;
> +---+--+
> |  _c0  |
> +---+--+
> | NULL  |
> +---+--+
> 1 row selected (0.658 seconds)
> {code}
> I can select expressions that evaluate to NULL or CAST NULL to different 
> types:
> {code}
> 0: jdbc:hive2://localhost:10016/> select null=null
> 0: jdbc:hive2://localhost:10016/> ;
> ++--+
> | (NULL = NULL)  |
> ++--+
> | NULL   |
> ++--+
> 1 row selected (0.69 seconds)
> 0: jdbc:hive2://localhost:10016/> select cast (NULL as int);
> ++--+
> | CAST(NULL AS INT)  |
> ++--+
> | NULL   |
> ++--+
> 1 row selected (0.676 seconds)
> 0: jdbc:hive2://localhost:10016/> select cast (NULL as string);
> +---+--+
> | CAST(NULL AS STRING)  |
> +---+--+
> | NULL  |
> +---+--+
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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



[jira] [Closed] (SPARK-17818) Cannot SELECT NULL

2016-10-06 Thread Todd Nemet (JIRA)

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

Todd Nemet closed SPARK-17818.
--
   Resolution: Duplicate
Fix Version/s: 2.0.2

> Cannot SELECT NULL
> --
>
> Key: SPARK-17818
> URL: https://issues.apache.org/jira/browse/SPARK-17818
> Project: Spark
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 2.0.0, 2.0.1
>Reporter: Todd Nemet
> Fix For: 2.0.2
>
>
> When connecting to Spark SQL via JDBC/thriftserver, running `SELECT NULL` 
> returns this error:
> {code}
> 0: jdbc:hive2://localhost:10016/> select cast(NULL as NULL);
> Error: org.apache.spark.sql.catalyst.parser.ParseException: 
> DataType null() is not supported.(line 1, pos 20)
> {code}
> This is a regression from Spark 1.x/Hive QL compatibility. In Spark 1.5.2, 
> The same query returns NULL:
> {code}
> 0: jdbc:hive2://localhost:10015/> select null;
> +---+--+
> |  _c0  |
> +---+--+
> | NULL  |
> +---+--+
> 1 row selected (0.658 seconds)
> {code}
> I can select expressions that evaluate to NULL or CAST NULL to different 
> types:
> {code}
> 0: jdbc:hive2://localhost:10016/> select null=null
> 0: jdbc:hive2://localhost:10016/> ;
> ++--+
> | (NULL = NULL)  |
> ++--+
> | NULL   |
> ++--+
> 1 row selected (0.69 seconds)
> 0: jdbc:hive2://localhost:10016/> select cast (NULL as int);
> ++--+
> | CAST(NULL AS INT)  |
> ++--+
> | NULL   |
> ++--+
> 1 row selected (0.676 seconds)
> 0: jdbc:hive2://localhost:10016/> select cast (NULL as string);
> +---+--+
> | CAST(NULL AS STRING)  |
> +---+--+
> | NULL  |
> +---+--+
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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



[jira] [Commented] (SPARK-17818) Cannot SELECT NULL

2016-10-06 Thread Todd Nemet (JIRA)

[ 
https://issues.apache.org/jira/browse/SPARK-17818?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15553779#comment-15553779
 ] 

Todd Nemet commented on SPARK-17818:


Definitely a duplicate. I did a search before filing - not sure how I missed 
it. Closing. Thanks for your help with this.

> Cannot SELECT NULL
> --
>
> Key: SPARK-17818
> URL: https://issues.apache.org/jira/browse/SPARK-17818
> Project: Spark
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 2.0.0, 2.0.1
>Reporter: Todd Nemet
>
> When connecting to Spark SQL via JDBC/thriftserver, running `SELECT NULL` 
> returns this error:
> {code}
> 0: jdbc:hive2://localhost:10016/> select cast(NULL as NULL);
> Error: org.apache.spark.sql.catalyst.parser.ParseException: 
> DataType null() is not supported.(line 1, pos 20)
> {code}
> This is a regression from Spark 1.x/Hive QL compatibility. In Spark 1.5.2, 
> The same query returns NULL:
> {code}
> 0: jdbc:hive2://localhost:10015/> select null;
> +---+--+
> |  _c0  |
> +---+--+
> | NULL  |
> +---+--+
> 1 row selected (0.658 seconds)
> {code}
> I can select expressions that evaluate to NULL or CAST NULL to different 
> types:
> {code}
> 0: jdbc:hive2://localhost:10016/> select null=null
> 0: jdbc:hive2://localhost:10016/> ;
> ++--+
> | (NULL = NULL)  |
> ++--+
> | NULL   |
> ++--+
> 1 row selected (0.69 seconds)
> 0: jdbc:hive2://localhost:10016/> select cast (NULL as int);
> ++--+
> | CAST(NULL AS INT)  |
> ++--+
> | NULL   |
> ++--+
> 1 row selected (0.676 seconds)
> 0: jdbc:hive2://localhost:10016/> select cast (NULL as string);
> +---+--+
> | CAST(NULL AS STRING)  |
> +---+--+
> | NULL  |
> +---+--+
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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



[jira] [Commented] (SPARK-17818) Cannot SELECT NULL

2016-10-06 Thread Todd Nemet (JIRA)

[ 
https://issues.apache.org/jira/browse/SPARK-17818?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15553777#comment-15553777
 ] 

Todd Nemet commented on SPARK-17818:


I don't believe you can CAST AS NULL in SQL since NullType isn't exposed at the 
SQL layer. Not an expert though.

> Cannot SELECT NULL
> --
>
> Key: SPARK-17818
> URL: https://issues.apache.org/jira/browse/SPARK-17818
> Project: Spark
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 2.0.0, 2.0.1
>Reporter: Todd Nemet
>
> When connecting to Spark SQL via JDBC/thriftserver, running `SELECT NULL` 
> returns this error:
> {code}
> 0: jdbc:hive2://localhost:10016/> select cast(NULL as NULL);
> Error: org.apache.spark.sql.catalyst.parser.ParseException: 
> DataType null() is not supported.(line 1, pos 20)
> {code}
> This is a regression from Spark 1.x/Hive QL compatibility. In Spark 1.5.2, 
> The same query returns NULL:
> {code}
> 0: jdbc:hive2://localhost:10015/> select null;
> +---+--+
> |  _c0  |
> +---+--+
> | NULL  |
> +---+--+
> 1 row selected (0.658 seconds)
> {code}
> I can select expressions that evaluate to NULL or CAST NULL to different 
> types:
> {code}
> 0: jdbc:hive2://localhost:10016/> select null=null
> 0: jdbc:hive2://localhost:10016/> ;
> ++--+
> | (NULL = NULL)  |
> ++--+
> | NULL   |
> ++--+
> 1 row selected (0.69 seconds)
> 0: jdbc:hive2://localhost:10016/> select cast (NULL as int);
> ++--+
> | CAST(NULL AS INT)  |
> ++--+
> | NULL   |
> ++--+
> 1 row selected (0.676 seconds)
> 0: jdbc:hive2://localhost:10016/> select cast (NULL as string);
> +---+--+
> | CAST(NULL AS STRING)  |
> +---+--+
> | NULL  |
> +---+--+
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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



[jira] [Created] (SPARK-17819) Specified database in JDBC URL is ignored when connecting to thriftserver

2016-10-06 Thread Todd Nemet (JIRA)
Todd Nemet created SPARK-17819:
--

 Summary: Specified database in JDBC URL is ignored when connecting 
to thriftserver
 Key: SPARK-17819
 URL: https://issues.apache.org/jira/browse/SPARK-17819
 Project: Spark
  Issue Type: Bug
  Components: SQL
Affects Versions: 2.0.1, 2.0.0, 1.6.2
Reporter: Todd Nemet


Filing this based on a email thread with Reynold Xin. From the 
[docs|http://spark.apache.org/docs/latest/sql-programming-guide.html#running-the-thrift-jdbcodbc-server],
 the JDBC connection URL to the thriftserver looks like:

{code}
beeline> !connect 
jdbc:hive2://:/?hive.server2.transport.mode=http;hive.server2.thrift.http.path=
{code}

However, anything specified in  results in being put in default 
schema. I'm running these with -e commands, but the shell shows the same 
behavior.

In 2.0.1, I created a table foo in schema spark_jira:

{code}
[558|18:01:20] ~/Documents/spark/spark$ bin/beeline -u 
jdbc:hive2://localhost:10006/spark_jira -n hive -e "show tables"
Connecting to jdbc:hive2://localhost:10006/spark_jira
16/10/06 18:01:28 INFO jdbc.Utils: Supplied authorities: localhost:10006
16/10/06 18:01:28 INFO jdbc.Utils: Resolved authority: localhost:10006
16/10/06 18:01:28 INFO jdbc.HiveConnection: Will try to open client transport 
with JDBC Uri: jdbc:hive2://localhost:10006/spark_jira
Connected to: Spark SQL (version 2.0.1)
Driver: Hive JDBC (version 1.2.1.spark2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
++--+--+
| tableName  | isTemporary  |
++--+--+
++--+--+
No rows selected (0.558 seconds)
Beeline version 1.2.1.spark2 by Apache Hive
Closing: 0: jdbc:hive2://localhost:10006/spark_jira
[559|18:01:30] ~/Documents/spark/spark$ bin/beeline -u 
jdbc:hive2://localhost:10006/spark_jira -n hive -e "show tables in spark_jira"
Connecting to jdbc:hive2://localhost:10006/spark_jira
16/10/06 18:01:34 INFO jdbc.Utils: Supplied authorities: localhost:10006
16/10/06 18:01:34 INFO jdbc.Utils: Resolved authority: localhost:10006
16/10/06 18:01:34 INFO jdbc.HiveConnection: Will try to open client transport 
with JDBC Uri: jdbc:hive2://localhost:10006/spark_jira
Connected to: Spark SQL (version 2.0.1)
Driver: Hive JDBC (version 1.2.1.spark2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
++--+--+
| tableName  | isTemporary  |
++--+--+
| foo| false|
++--+--+
1 row selected (0.664 seconds)
Beeline version 1.2.1.spark2 by Apache Hive
Closing: 0: jdbc:hive2://localhost:10006/spark_jira
{code}

I also see this in Spark 1.6.2:
{code}
[555|18:13:32] ~/Documents/spark/spark16$ bin/beeline -u 
jdbc:hive2://localhost:10005/spark_jira -n hive -e "show tables"
Connecting to jdbc:hive2://localhost:10005/spark_jira
16/10/06 18:13:37 INFO jdbc.Utils: Supplied authorities: localhost:10005
16/10/06 18:13:37 INFO jdbc.Utils: Resolved authority: localhost:10005
16/10/06 18:13:37 INFO jdbc.HiveConnection: Will try to open client transport 
with JDBC Uri: jdbc:hive2://localhost:10005/spark_jira
Connected to: Spark SQL (version 1.6.2)
Driver: Hive JDBC (version 1.2.1.spark2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
+--+--+--+
|  tableName   | isTemporary  |
+--+--+--+
| all_types| false|
| order_items  | false|
| orders   | false|
| users| false|
+--+--+--+
4 rows selected (0.653 seconds)
Beeline version 1.2.1.spark2 by Apache Hive
Closing: 0: jdbc:hive2://localhost:10005/spark_jira
[556|18:13:39] ~/Documents/spark/spark16$ bin/beeline -u 
jdbc:hive2://localhost:10005/spark_jira -n hive -e "show tables in spark_jira"
Connecting to jdbc:hive2://localhost:10005/spark_jira
16/10/06 18:13:45 INFO jdbc.Utils: Supplied authorities: localhost:10005
16/10/06 18:13:45 INFO jdbc.Utils: Resolved authority: localhost:10005
16/10/06 18:13:45 INFO jdbc.HiveConnection: Will try to open client transport 
with JDBC Uri: jdbc:hive2://localhost:10005/spark_jira
Connected to: Spark SQL (version 1.6.2)
Driver: Hive JDBC (version 1.2.1.spark2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
++--+--+
| tableName  | isTemporary  |
++--+--+
| foo| false|
++--+--+
1 row selected (0.633 seconds)
Beeline version 1.2.1.spark2 by Apache Hive
Closing: 0: jdbc:hive2://localhost:10005/spark_jira
{code}

This appeared to work back in Spark 1.4.1:
{code}
[560|18:17:19] ~/Documents/spark/spark14$ bin/beeline -u 
jdbc:hive2://localhost:11001/imdb -n hive -e "show tables"
scan complete in 2ms
Connecting to jdbc:hive2://localhost:11001/imdb
Connected to: Spark SQL (version 1.4.1)
Driver: Spark Project Core (version 1.4.1)
Transaction isolation: TRANSACTION_REPEATABLE_RE

[jira] [Created] (SPARK-17818) Cannot SELECT NULL

2016-10-06 Thread Todd Nemet (JIRA)
Todd Nemet created SPARK-17818:
--

 Summary: Cannot SELECT NULL
 Key: SPARK-17818
 URL: https://issues.apache.org/jira/browse/SPARK-17818
 Project: Spark
  Issue Type: Bug
  Components: SQL
Affects Versions: 2.0.1, 2.0.0
Reporter: Todd Nemet


When connecting to Spark SQL via JDBC/thriftserver, running `SELECT NULL` 
returns this error:

{code}
0: jdbc:hive2://localhost:10016/> select cast(NULL as NULL);
Error: org.apache.spark.sql.catalyst.parser.ParseException: 
DataType null() is not supported.(line 1, pos 20)
{code}

This is a regression from Spark 1.x/Hive QL compatibility. In Spark 1.5.2, The 
same query returns NULL:

{code}
0: jdbc:hive2://localhost:10015/> select null;
+---+--+
|  _c0  |
+---+--+
| NULL  |
+---+--+
1 row selected (0.658 seconds)
{code}

I can select expressions that evaluate to NULL or CAST NULL to different types:
{code}
0: jdbc:hive2://localhost:10016/> select null=null
0: jdbc:hive2://localhost:10016/> ;
++--+
| (NULL = NULL)  |
++--+
| NULL   |
++--+
1 row selected (0.69 seconds)
0: jdbc:hive2://localhost:10016/> select cast (NULL as int);
++--+
| CAST(NULL AS INT)  |
++--+
| NULL   |
++--+
1 row selected (0.676 seconds)
0: jdbc:hive2://localhost:10016/> select cast (NULL as string);
+---+--+
| CAST(NULL AS STRING)  |
+---+--+
| NULL  |
+---+--+
{code}




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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