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

VectorizedParquetRecordReader can't to read parquet file generated using thrift/custom tool

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.0.0-alpha-1
    • Parquet
    • None

    Description

      Taking an example of a parquet table having array of integers as below. 

      CREATE EXTERNAL TABLE ( list_of_ints` array<int>)
      STORED AS PARQUET 
      LOCATION '{location}';
      

      Parquet file generated using hive will have schema for Type as below:

      group list_of_ints (LIST) { repeated group bag { optional int32 array;\n};\n} 

      Parquet file generated using thrift or any custom tool (using org.apache.parquet.io.api.RecordConsumer)

      may have schema for Type as below:

      required group list_of_ints (LIST) { repeated int32 list_of_tuple} 

      VectorizedParquetRecordReader handles only parquet file generated using hive. It throws the following exception when parquet file generated using thrift is read because of the changes done as part of HIVE-18553 .

      Caused by: java.lang.ClassCastException: repeated int32 list_of_ints_tuple is not a group
       at org.apache.parquet.schema.Type.asGroupType(Type.java:207)
       at org.apache.hadoop.hive.ql.io.parquet.vector.VectorizedParquetRecordReader.getElementType(VectorizedParquetRecordReader.java:479)
       at org.apache.hadoop.hive.ql.io.parquet.vector.VectorizedParquetRecordReader.buildVectorizedParquetReader(VectorizedParquetRecordReader.java:532)
       at org.apache.hadoop.hive.ql.io.parquet.vector.VectorizedParquetRecordReader.checkEndOfRowGroup(VectorizedParquetRecordReader.java:440)
       at org.apache.hadoop.hive.ql.io.parquet.vector.VectorizedParquetRecordReader.nextBatch(VectorizedParquetRecordReader.java:401)
       at org.apache.hadoop.hive.ql.io.parquet.vector.VectorizedParquetRecordReader.next(VectorizedParquetRecordReader.java:353)
       at org.apache.hadoop.hive.ql.io.parquet.vector.VectorizedParquetRecordReader.next(VectorizedParquetRecordReader.java:92)
       at org.apache.hadoop.hive.ql.io.HiveContextAwareRecordReader.doNext(HiveContextAwareRecordReader.java:365)

       

       I have done a small change to handle the case where the child type of group type can be PrimitiveType.

      Attachments

        1. HIVE-21492.5.patch
          4 kB
          Ganesha Shreedhara
        2. HIVE-21492.4.patch
          4 kB
          Ganesha Shreedhara
        3. HIVE-21492.3.patch
          4 kB
          Ganesha Shreedhara
        4. HIVE-21492.2.patch
          4 kB
          Ganesha Shreedhara
        5. HIVE-21492.patch
          1 kB
          Ganesha Shreedhara

        Activity

          People

            ganeshas Ganesha Shreedhara
            ganeshas Ganesha Shreedhara
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: