[ 
https://issues.apache.org/jira/browse/HIVE-11217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14804973#comment-14804973
 ] 

Prasanth Jayachandran commented on HIVE-11217:
----------------------------------------------

I tried the following 
{code:title=TEXT}
hive> create table test_text as select null from loc_orc;
OK
hive> desc test_text;
OK
_c0                     void     
hive> insert into test_text select '1' from loc_orc;
FAILED: UDFArgumentException void not found.
{code}

{code:title=RCFILE}
hive> create table test_rcfile stored as rcfile as select null from loc_orc;
OK
hive> desc test_rcfile;
OK
_c0                     void      
hive> insert into test_rcfile select '1' from loc_orc;
FAILED: UDFArgumentException void not found.
{code}

{code:title=AVRO}
hive> create table test_avro stored as avro as select null from loc_orc;
OK
hive> desc test_avro;
OK
_c0                     void      
hive> insert into test_avro select '1' from loc_orc;
FAILED: UDFArgumentException void not found.
{code}

{code:title=PARQUET}
hive> create table test_parquet stored as parquet as select null from loc_orc;
FAILED: Execution Error, return code 1 from 
org.apache.hadoop.hive.ql.exec.DDLTask. 
java.lang.UnsupportedOperationException: Unknown field type: void
{code}

{code:title=ORC}
hive> create table test_orc stored as orc as select null from loc_orc;
FAILED: Execution Error, return code 1 from 
org.apache.hadoop.hive.ql.exec.DDLTask. java.lang.IllegalArgumentException: 
Unknown primitive type VOID
{code}

Text, RCFile and Avro succeeds CTAS. The type is void but we cannot add any 
more rows to that table other than nulls which I don't find quite useful.

Parquet and ORC fails the query at runtime. 

I still don't see the usefulness of supporting void in ORC. I think it's better 
to fail (preferably much early) than supporting void type to which we cannot 
add any non-void type values.

> CTAS statements throws error, when the table is stored as ORC File format and 
> select clause has NULL/VOID type column 
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-11217
>                 URL: https://issues.apache.org/jira/browse/HIVE-11217
>             Project: Hive
>          Issue Type: Bug
>          Components: File Formats
>    Affects Versions: 0.13.1
>            Reporter: Gaurav Kohli
>            Assignee: Yongzhi Chen
>            Priority: Minor
>         Attachments: HIVE-11217.1.patch, HIVE-11217.2.patch, 
> HIVE-11217.3.patch, HIVE-11217.4.patch
>
>
> If you try to use create-table-as-select (CTAS) statement and create a ORC 
> File format based table, then you can't use NULL as a column value in select 
> clause 
> CREATE TABLE empty (x int);
> CREATE TABLE orc_table_with_null 
> STORED AS ORC 
> AS 
> SELECT 
> x,
> null
> FROM empty;
> Error: 
> {quote}
> 347084 [main] ERROR hive.ql.exec.DDLTask  - 
> org.apache.hadoop.hive.ql.metadata.HiveException: 
> java.lang.IllegalArgumentException: Unknown primitive type VOID
>       at org.apache.hadoop.hive.ql.metadata.Hive.createTable(Hive.java:643)
>       at org.apache.hadoop.hive.ql.exec.DDLTask.createTable(DDLTask.java:4242)
>       at org.apache.hadoop.hive.ql.exec.DDLTask.execute(DDLTask.java:285)
>       at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:153)
>       at 
> org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:85)
>       at org.apache.hadoop.hive.ql.Driver.launchTask(Driver.java:1554)
>       at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:1321)
>       at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1139)
>       at org.apache.hadoop.hive.ql.Driver.run(Driver.java:962)
>       at org.apache.hadoop.hive.ql.Driver.run(Driver.java:952)
>       at 
> org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:269)
>       at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:221)
>       at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:431)
>       at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:367)
>       at 
> org.apache.hadoop.hive.cli.CliDriver.processReader(CliDriver.java:464)
>       at org.apache.hadoop.hive.cli.CliDriver.processFile(CliDriver.java:474)
>       at 
> org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:756)
>       at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:694)
>       at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:633)
>       at org.apache.oozie.action.hadoop.HiveMain.runHive(HiveMain.java:323)
>       at org.apache.oozie.action.hadoop.HiveMain.run(HiveMain.java:284)
>       at org.apache.oozie.action.hadoop.LauncherMain.run(LauncherMain.java:39)
>       at org.apache.oozie.action.hadoop.HiveMain.main(HiveMain.java:66)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:606)
>       at 
> org.apache.oozie.action.hadoop.LauncherMapper.map(LauncherMapper.java:227)
>       at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:54)
>       at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:450)
>       at org.apache.hadoop.mapred.MapTask.run(MapTask.java:343)
>       at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:168)
>       at java.security.AccessController.doPrivileged(Native Method)
>       at javax.security.auth.Subject.doAs(Subject.java:415)
>       at 
> org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1642)
>       at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:163)
> Caused by: java.lang.IllegalArgumentException: Unknown primitive type VOID
>       at 
> org.apache.hadoop.hive.ql.io.orc.OrcStruct.createObjectInspector(OrcStruct.java:530)
>       at 
> org.apache.hadoop.hive.ql.io.orc.OrcStruct$OrcStructInspector.<init>(OrcStruct.java:195)
>       at 
> org.apache.hadoop.hive.ql.io.orc.OrcStruct.createObjectInspector(OrcStruct.java:534)
>       at 
> org.apache.hadoop.hive.ql.io.orc.OrcSerde.initialize(OrcSerde.java:106)
>       at 
> org.apache.hadoop.hive.serde2.SerDeUtils.initializeSerDe(SerDeUtils.java:519)
>       at 
> org.apache.hadoop.hive.metastore.MetaStoreUtils.getDeserializer(MetaStoreUtils.java:345)
>       at 
> org.apache.hadoop.hive.ql.metadata.Table.getDeserializerFromMetaStore(Table.java:292)
>       at 
> org.apache.hadoop.hive.ql.metadata.Table.checkValidity(Table.java:194)
>       at org.apache.hadoop.hive.ql.metadata.Hive.createTable(Hive.java:621)
>       ... 35 more
> {quote}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to