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

Dongjoon Hyun commented on SPARK-17818:
---------------------------------------

Now, everything seems to work. BTW, the first example is not a regression. 
Spark 1.6.2 also works like the following.
{code}
bin/beeline -u jdbc:hive2://localhost:10000 -e "select cast(NULL as NULL)"
Connecting to jdbc:hive2://localhost:10000
log4j:WARN No appenders could be found for logger (org.apache.hive.jdbc.Utils).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more 
info.
Connected to: Spark SQL (version 1.6.2)
Driver: Hive JDBC (version 1.2.1.spark2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Error: org.apache.spark.sql.AnalysisException: cannot recognize input near 
'NULL' ')' '<EOF>' in primitive type specification; line 1 pos 20 
(state=,code=0)
Closing: 0: jdbc:hive2://localhost:10000
{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
>
> 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

Reply via email to