Description
When connecting to Spark SQL via JDBC/thriftserver, running `SELECT NULL` returns this error:
0: jdbc:hive2://localhost:10016/> select NULL; Error: java.lang.IllegalArgumentException: Unrecognized type name: null (state=,code=0)
Note: I originally pasted in this code erroneously:
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)
This is a regression from Spark 1.x/Hive QL compatibility. In Spark 1.5.2, The same query returns NULL:
0: jdbc:hive2://localhost:10015/> select null;
+-------+--+
| _c0 |
+-------+--+
| NULL |
+-------+--+
1 row selected (0.658 seconds)
I can select expressions that evaluate to NULL or CAST NULL to different types:
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 | +-----------------------+--+
Attachments
Issue Links
- duplicates
-
SPARK-17112 "select if(true, null, null)" via JDBC triggers IllegalArgumentException in Thriftserver
- Resolved