Created 04-01-2017 01:13 AM
I am using HDP-2.4.0.7 and ORC is the default format for Hive.
One of my CTAS Hive query to create a table, fails with the following error:
return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. java.lang.IllegalArgumentException: Unknown primitive type VOID
Created 04-01-2017 02:35 AM
Are you using NULL in the select clause, in that case you might be encountering HIVE-11217. As per the JIRA there is no fix but the error message is improved with something like:
CREATE-TABLE-AS-SELECT creates a VOID type, please use CAST to specify the type
Created 04-01-2017 02:35 AM
Are you using NULL in the select clause, in that case you might be encountering HIVE-11217. As per the JIRA there is no fix but the error message is improved with something like:
CREATE-TABLE-AS-SELECT creates a VOID type, please use CAST to specify the type
Created 04-01-2017 03:32 AM
@Deepesh - Yes, I am using CAST to specify the type. In my case the select has - "CAST(NULL AS bigint)".
Created 04-01-2017 03:44 AM
@Deepesh - I checked the Hive-11217 JIRA you posted here. It appears the fix was applied to Hive versions 1.3.0 and 2.0. Does that mean that people using Hive Versions lowers than 1.3.0 will face this issue even if they are using CAST ?
Created 04-02-2017 09:23 PM
No, HIVE-11217 was about improving the error message. "CAST(NULL AS bigint)" should work irrespective of this fix. Can you share your query?
Created 04-03-2017 06:44 PM
Thank you @Deepesh. Turns out there was a different version of code in different clusters. So, when I used CAST it worked fine.
Created 04-03-2017 02:28 AM
Yes as siad by @Deepesh it should work. But if you query is something like this create table as select col1,col2 from mytable; and if your col2 contains 100% null in mytable then the table will be created successfully with void as datatype. However you will not be allowed to append anymore data with valid values into it.
Created 04-03-2017 06:44 PM
Thank you. Upvoted your answer.
Created 04-03-2017 06:47 PM
If you have used CAST then it should not throw any exception and should work absolutely fine.