new AcidInputFormat.Options(conf)); int record = 0; RecordIdentifier id = reader.createKey(); OrcStruct struct = reader.createValue(); while (reader.next(id, struct)) { assertEquals("id " + record, record, id.getRowId()); assertEquals("bucket " + record, 0, id.getBucketProperty()); reader.close(); reader = inputFormat.getReader(split, new AcidInputFormat.Options(conf)); record = 0; id = reader.createKey(); struct = reader.createValue(); while (reader.next(id, struct)) { assertEquals("id " + record, record, id.getRowId()); assertEquals("bucket " + record, 0, id.getBucketProperty()); reader.close();
@Override public boolean next(NullWritable nullWritable, VectorizedRowBatch vectorizedRowBatch ) throws IOException { 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; }
VectorizedOrcAcidRowReader(AcidInputFormat.RowReader<OrcStruct> inner, Configuration conf, FileSplit split) throws IOException { this.innerReader = inner; this.key = inner.createKey(); this.rowBatchCtx = new VectorizedRowBatchCtx(); this.value = inner.createValue(); this.objectInspector = inner.getObjectInspector(); try { rowBatchCtx.init(conf, split); } catch (ClassNotFoundException e) { throw new IOException("Failed to initialize context", e); } catch (SerDeException e) { throw new IOException("Failed to initialize context", e); } catch (InstantiationException e) { throw new IOException("Failed to initialize context", e); } catch (IllegalAccessException e) { throw new IOException("Failed to initialize context", e); } catch (HiveException e) { throw new IOException("Failed to initialize context", e); } }
@Override public long getPos() throws IOException { return inner.getPos(); }
@Override public long getPos() throws IOException { return innerReader.getPos(); }
@Override public void close() throws IOException { innerReader.close(); }
@Override public OrcStruct createValue() { return inner.createValue(); }
@Override public void close() throws IOException { inner.close(); }
@Override public boolean next(NullWritable nullWritable, OrcStruct orcStruct) throws IOException { return inner.next(id, orcStruct); }
@Override public float getProgress() throws IOException { return innerReader.getProgress(); } }
private NullKeyRecordReader(RowReader<OrcStruct> inner, Configuration conf) { this.inner = inner; id = inner.createKey(); } @Override
@Override public float getProgress() throws IOException { return inner.getProgress(); } }
RecordIdentifier id = reader.createKey(); OrcStruct struct = reader.createValue(); while (reader.next(id, struct)) { record += 1; reader.close();
@Override public boolean next(NullWritable nullWritable, VectorizedRowBatch vectorizedRowBatch ) throws IOException { vectorizedRowBatch.reset(); buffer.reset(); if (!innerReader.next(key, value)) { return false; } if (partitionValues != null) { rbCtx.addPartitionColsToBatch(vectorizedRowBatch, partitionValues); } try { VectorizedBatchUtil.acidAddRowToBatch(value, (StructObjectInspector) objectInspector, vectorizedRowBatch.size++, vectorizedRowBatch, rbCtx, buffer); while (vectorizedRowBatch.size < vectorizedRowBatch.selected.length && innerReader.next(key, value)) { VectorizedBatchUtil.acidAddRowToBatch(value, (StructObjectInspector) objectInspector, vectorizedRowBatch.size++, vectorizedRowBatch, rbCtx, buffer); } } catch (Exception e) { throw new IOException("error iterating", e); } return true; }
VectorizedOrcAcidRowReader(AcidInputFormat.RowReader<OrcStruct> inner, Configuration conf, VectorizedRowBatchCtx vectorizedRowBatchCtx, FileSplit split) throws IOException { this.innerReader = inner; this.key = inner.createKey(); rbCtx = vectorizedRowBatchCtx; int partitionColumnCount = rbCtx.getPartitionColumnCount(); if (partitionColumnCount > 0) { partitionValues = new Object[partitionColumnCount]; rbCtx.getPartitionValues(rbCtx, conf, split, partitionValues); } this.value = inner.createValue(); this.objectInspector = inner.getObjectInspector(); }
@Override public long getPos() throws IOException { return innerReader.getPos(); }
@Override public OrcStruct createValue() { return inner.createValue(); }
@Override public void close() throws IOException { inner.close(); }
@Override public long getPos() throws IOException { return inner.getPos(); }
@Override public void close() throws IOException { innerReader.close(); }