public NullableVarBinaryWriterImpl(NullableVarBinaryVector vector, AbstractFieldWriter parent) { super(parent); this.mutator = vector.getMutator(); this.vector = vector; }
@Override public void toNullable(ValueVector nullableVector) { NullableVarBinaryVector dest = (NullableVarBinaryVector) nullableVector; dest.getMutator().fromNotNullable(this); }
@Override public void setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) { final byte[] value = ((BinaryObjectInspector)oi).getPrimitiveJavaObject(hiveFieldValue); ((NullableVarBinaryVector) outputVV).getMutator().setSafe(outputIndex, value, 0, value.length); } }
public void setSafe(int index, NullableVarBinaryHolder holder) { setType(index, MinorType.VARBINARY); getVarBinaryVector().getMutator().setSafe(index, holder); }
public void writeNull() { mutator.setNull(idx()); vector.getMutator().setValueCount(idx() + 1); }
public void write(VarBinaryHolder h) { mutator.setSafe(idx(), h); vector.getMutator().setValueCount(idx()+1); }
public void write(NullableVarBinaryHolder h) { mutator.setSafe(idx(), h); vector.getMutator().setValueCount(idx()+1); }
public void writeVarBinary(int start, int end, DrillBuf buffer) { mutator.setSafe(idx(), 1, start, end, buffer); vector.getMutator().setValueCount(idx() + 1); }
final int valueLength = cell.getValueLength(); final byte[] valueArray = cell.getValueArray(); v.getMutator().setSafe(rowCount, valueArray, valueOffset, valueLength);
byte[] value = (byte[]) val; for (int i = start; i < end; i++) { v.getMutator().setSafe(i, value, 0, value.length);
public NullableVarBinaryWriterImpl(NullableVarBinaryVector vector, AbstractFieldWriter parent) { super(parent); this.mutator = vector.getMutator(); this.vector = vector; }
NullableVarBinaryColumn(ParquetRecordReader parentReader, ColumnDescriptor descriptor, ColumnChunkMetaData columnChunkMetaData, boolean fixedLength, NullableVarBinaryVector v, SchemaElement schemaElement) throws ExecutionSetupException { super(parentReader, descriptor, columnChunkMetaData, fixedLength, v, schemaElement); this.nullableVarBinaryVector = v; this.mutator = v.getMutator(); }
@Override public void toNullable(ValueVector nullableVector) { NullableVarBinaryVector dest = (NullableVarBinaryVector) nullableVector; dest.getMutator().fromNotNullable(this); }
public void setSafe(int index, NullableVarBinaryHolder holder) { setType(index, MinorType.VARBINARY); getVarBinaryVector().getMutator().setSafe(index, holder); }
public void writeVarBinary(int start, int end, DrillBuf buffer) { mutator.setSafe(idx(), 1, start, end, buffer); vector.getMutator().setValueCount(idx() + 1); }
public void write(VarBinaryHolder h) { mutator.setSafe(idx(), h); vector.getMutator().setValueCount(idx()+1); }
public void write(NullableVarBinaryHolder h) { mutator.setSafe(idx(), h); vector.getMutator().setValueCount(idx()+1); }
public void writeNull() { mutator.setNull(idx()); vector.getMutator().setValueCount(idx() + 1); }
@Override public int next() { final Stopwatch watch = Stopwatch.createStarted(); if (keyVector != null) { keyVector.clear(); keyVector.allocateNew(); } if (valueVector != null) { valueVector.clear(); valueVector.allocateNew(); } int recordCount = 0; int batchSize = 0; try { while (recordCount < PER_BATCH_RECORD_COUNT && batchSize < PER_BATCH_BYTES && reader.next(key, value)) { keyVector.getMutator().setSafe(recordCount, key.getBytes(), 0, key.getLength()); valueVector.getMutator().setSafe(recordCount, value.getBytes(), 0, value.getLength()); batchSize += (key.getLength() + value.getLength()); ++recordCount; } keyVector.getMutator().setValueCount(recordCount); valueVector.getMutator().setValueCount(recordCount); logger.debug("Read {} records in {} ms", recordCount, watch.elapsed(TimeUnit.MILLISECONDS)); return recordCount; } catch (IOException ioe) { close(); throw UserException.dataReadError(ioe).addContext("File Path", split.getPath().toString()).build(logger); } }
@Override protected void readField(long recordsToReadInThisPass) { this.bytebuf = pageReader.pageData; if (usingDictionary) { NullableVarBinaryVector.Mutator mutator = valueVec.getMutator(); Binary currDictValToWrite; for (int i = 0; i < recordsToReadInThisPass; i++) { currDictValToWrite = pageReader.dictionaryValueReader.readBytes(); ByteBuffer buf = currDictValToWrite.toByteBuffer(); mutator.setSafe(valuesReadInCurrentPass + i, buf, buf.position(), currDictValToWrite.length()); } // Set the write Index. The next page that gets read might be a page that does not use dictionary encoding // and we will go into the else condition below. The readField method of the parent class requires the // writer index to be set correctly. int writerIndex = castedBaseVector.getBuffer().writerIndex(); castedBaseVector.getBuffer().setIndex(0, writerIndex + (int) readLength); } else { super.readField(recordsToReadInThisPass); // TODO - replace this with fixed binary type in drill // for now we need to write the lengths of each value int byteLength = dataTypeLengthInBits / 8; for (int i = 0; i < recordsToReadInThisPass; i++) { valueVec.getMutator().setValueLengthSafe(valuesReadInCurrentPass + i, byteLength); } } } }