[ https://issues.apache.org/jira/browse/HIVE-2615?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13159720#comment-13159720 ]
David Phillips commented on HIVE-2615: -------------------------------------- I see this as three different issues: # The NULL literal produces a VOID type. # Tables with a VOID type cannot be queried at all. # Queries for tables with a VOID type fail at execution time rather than compile time. Some potential solutions: # Treat a VOID type as always being NULL. This is a non-backwards-compatible object inspector change that require changes all over the place, including third party code. # Pick a type for a NULL literal in CTAS. There is no obvious choice for the type, but STRING seems like the best option. # Have the CTAS error out at compile time with a hint for the user to use CAST to specify the type. > CTAS with literal NULL creates VOID type > ---------------------------------------- > > Key: HIVE-2615 > URL: https://issues.apache.org/jira/browse/HIVE-2615 > Project: Hive > Issue Type: Bug > Reporter: David Phillips > > Create the table with a column that always contains NULL: > {quote} > hive> create table bad as select 1 x, null z from dual; > {quote} > Because there's no type, Hive gives it the VOID type: > {quote} > hive> describe bad; > OK > x int > z void > {quote} > This seems weird, because AFAIK, there is no normal way to create a column of > type VOID. The problem is that the table can't be queried: > {quote} > hive> select * from bad; > OK > Failed with exception java.io.IOException:java.lang.RuntimeException: > Internal error: no LazyObject for VOID > {quote} > Worse, even if you don't select that field, the query fails at runtime: > {quote} > hive> select x from bad; > ... > FAILED: Execution Error, return code 2 from > org.apache.hadoop.hive.ql.exec.MapRedTask > {quote} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira