Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Hive CTAS throws IllegalArgumentException - Unknown primitive type VOID

avatar

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

avatar

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

View solution in original post

8 REPLIES 8

avatar

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

avatar

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

avatar

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

avatar

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

avatar

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

avatar

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.

avatar

Thank you. Upvoted your answer.

avatar
Super Collaborator

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