Ejemplo n.º 1
0
 public bool next(NullWritable key, VectorizedRowBatch value)
 {
     if (!reader.hasNext())
     {
         return(false);
     }
     try
     {
         // Check and update partition cols if necessary. Ideally, this should be done
         // in CreateValue as the partition is constant per split. But since Hive uses
         // CombineHiveRecordReader and
         // as this does not call CreateValue for each new RecordReader it creates, this check is
         // required in next()
         if (addPartitionCols)
         {
             rbCtx.addPartitionColsToBatch(value);
             addPartitionCols = false;
         }
         reader.nextBatch(value);
     }
     catch (Exception e)
     {
         throw;
     }
     progress = reader.getProgress();
     return(true);
 }
 public bool next(NullWritable nullWritable,
                  VectorizedRowBatch vectorizedRowBatch
                  )
 {
     vectorizedRowBatch.reset();
     buffer.reset();
     if (!innerReader.next(key, value))
     {
         return(false);
     }
     try
     {
         rowBatchCtx.addPartitionColsToBatch(vectorizedRowBatch);
     }
     catch (HiveException e)
     {
         throw new IOException("Problem adding partition column", e);
     }
     try
     {
         VectorizedBatchUtil.acidAddRowToBatch(value,
                                               (StructObjectInspector)objectInspector,
                                               vectorizedRowBatch.size++, vectorizedRowBatch, rowBatchCtx, buffer);
         while (vectorizedRowBatch.size < vectorizedRowBatch.selected.length &&
                innerReader.next(key, value))
         {
             VectorizedBatchUtil.acidAddRowToBatch(value,
                                                   (StructObjectInspector)objectInspector,
                                                   vectorizedRowBatch.size++, vectorizedRowBatch, rowBatchCtx, buffer);
         }
     }
     catch (HiveException he)
     {
         throw new IOException("error iterating", he);
     }
     return(true);
 }