Hive
  1. Hive
  2. HIVE-5456

Queries fail on avro backed table with empty partition

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.11.0, 0.13.1
    • Fix Version/s: 0.14.0
    • Component/s: Query Processor
    • Labels:
      None

      Description

      The following query fails

      DROP TABLE IF EXISTS episodes_partitioned;
      CREATE TABLE episodes_partitioned
      PARTITIONED BY (doctor_pt INT)
      ROW FORMAT
      SERDE 'org.apache.hadoop.hive.serde2.avro.AvroSerDe'
      STORED AS
      INPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat'
      OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat'
      TBLPROPERTIES ('avro.schema.literal'='{
        "namespace": "testing.hive.avro.serde",
        "name": "episodes",
        "type": "record",
        "fields": [
          {
            "name":"title",
            "type":"string",
            "doc":"episode title"
          },
          {
            "name":"air_date",
            "type":"string",
            "doc":"initial date"
          },
          {
            "name":"doctor",
            "type":"int",
            "doc":"main actor playing the Doctor in episode"
          }
        ]
      }');
      
      ALTER TABLE episodes_partitioned ADD PARTITION (doctor_pt=4);
      ALTER TABLE episodes_partitioned ADD PARTITION (doctor_pt=5);
      SELECT COUNT(*) FROM episodes_partitioned;
      

      with following exception

      java.io.IOException: org.apache.hadoop.hive.serde2.avro.AvroSerdeException: Neither avro.schema.literal nor avro.schema.url specified, can't determine table schema
              at org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat.getHiveRecordWriter(AvroContainerOutputFormat.java:61)
              at org.apache.hadoop.hive.ql.exec.Utilities.createEmptyFile(Utilities.java:2869)
              at org.apache.hadoop.hive.ql.exec.Utilities.createDummyFileForEmptyPartition(Utilities.java:2901)
              at org.apache.hadoop.hive.ql.exec.Utilities.getInputPaths(Utilities.java:2825)
              at org.apache.hadoop.hive.ql.exec.mr.ExecDriver.execute(ExecDriver.java:381)
              at org.apache.hadoop.hive.ql.exec.mr.MapRedTask.execute(MapRedTask.java:136)
              at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:151)
              at org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:65)
              at org.apache.hadoop.hive.ql.Driver.launchTask(Driver.java:1409)
              at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:1187)
              at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1015)
              at org.apache.hadoop.hive.ql.Driver.run(Driver.java:883)
              at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:259)
              at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:216)
              at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:413)
              at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:348)
              at org.apache.hadoop.hive.cli.CliDriver.processReader(CliDriver.java:446)
              at org.apache.hadoop.hive.cli.CliDriver.processFile(CliDriver.java:456)
              at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:737)
              at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:675)
              at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:614)
      
      1. HIVE-5456.patch
        4 kB
        Chaoyu Tang
      2. HIVE-5456.patch
        4 kB
        Chaoyu Tang

        Issue Links

          Activity

            People

            • Assignee:
              Chaoyu Tang
              Reporter:
              Prasad Mujumdar
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development