Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Hive CTAS throws IllegalArgumentException - Unknown primitive type VOID

Solved Go to solution

Hive CTAS throws IllegalArgumentException - Unknown primitive type VOID

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
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Hive CTAS throws IllegalArgumentException - Unknown primitive type VOID

Master Collaborator

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
8 REPLIES 8

Re: Hive CTAS throws IllegalArgumentException - Unknown primitive type VOID

Master Collaborator

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

Re: Hive CTAS throws IllegalArgumentException - Unknown primitive type VOID

@Deepesh - Yes, I am using CAST to specify the type. In my case the select has - "CAST(NULL AS bigint)".

Re: Hive CTAS throws IllegalArgumentException - Unknown primitive type VOID

@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 ?

Re: Hive CTAS throws IllegalArgumentException - Unknown primitive type VOID

Master Collaborator

No, HIVE-11217 was about improving the error message. "CAST(NULL AS bigint)" should work irrespective of this fix. Can you share your query?

Re: Hive CTAS throws IllegalArgumentException - Unknown primitive type VOID

Thank you @Deepesh. Turns out there was a different version of code in different clusters. So, when I used CAST it worked fine.

Re: Hive CTAS throws IllegalArgumentException - Unknown primitive type VOID

Hi @Dinesh Chitlangia

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.

Re: Hive CTAS throws IllegalArgumentException - Unknown primitive type VOID

Thank you. Upvoted your answer.

Highlighted

Re: Hive CTAS throws IllegalArgumentException - Unknown primitive type VOID

Expert Contributor

If you have used CAST then it should not throw any exception and should work absolutely fine.

Don't have an account?
Coming from Hortonworks? Activate your account here