Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-11217

CTAS statements throws error, when the table is stored as ORC File format and select clause has NULL/VOID type column

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 0.13.1
    • Fix Version/s: 1.3.0, 2.0.0
    • Component/s: File Formats
    • Labels:
      None

      Description

      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:

      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

        Attachments

        1. HIVE-11217.1.patch
          5 kB
          Yongzhi Chen
        2. HIVE-11217.2.patch
          8 kB
          Yongzhi Chen
        3. HIVE-11217.3.patch
          5 kB
          Yongzhi Chen
        4. HIVE-11217.4.patch
          5 kB
          Yongzhi Chen
        5. HIVE-11217.5.patch
          3 kB
          Yongzhi Chen

          Issue Links

            Activity

              People

              • Assignee:
                ychena Yongzhi Chen
                Reporter:
                gauravkohli Gaurav Kohli
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: