@Override void copy(int index) throws SQLException { byte[] record = result.getBytes(columnIndex); if (record != null) { mutator.setSafe(index, record, 0, record.length); } }
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);
bytes = getBytes(type, s); varBinaryVector.getMutator().setSafe(index, bytes, 0, bytes.length); return;
final int valueLength = cell.getValueLength(); final byte[] valueArray = cell.getValueArray(); v.getMutator().setSafe(rowCount, valueArray, valueOffset, valueLength);
@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); } } } }
public void write(NullableVarBinaryHolder h) { mutator.setSafe(idx(), h); vector.getMutator().setValueCount(idx()+1); }
public void write(VarBinaryHolder h) { mutator.setSafe(idx(), h); vector.getMutator().setValueCount(idx()+1); }
public void setSafe(int index, NullableVarBinaryHolder holder) { setType(index, MinorType.VARBINARY); getVarBinaryVector().getMutator().setSafe(index, holder); }
@Override public boolean setSafe(int index, DrillBuf value, int start, int length) { if (index >= nullableVarBinaryVector.getValueCapacity()) { return false; } if (usingDictionary) { ByteBuffer buf = currDictValToWrite.toByteBuffer(); mutator.setSafe(index, buf, buf.position(), currDictValToWrite.length()); } else { mutator.setSafe(index, 1, start, start + length, value); } return true; }
public void writeVarBinary(int start, int end, DrillBuf buffer) { mutator.setSafe(idx(), 1, start, end, buffer); vector.getMutator().setValueCount(idx() + 1); }
/** {@inheritDoc} */ @Override protected void setSafe(VarLenBulkInput<VarLenBulkEntry> bulkInput) { mutator.setSafe(bulkInput); }
if (pci.kuduColumn.isNullable()) { ((NullableVarBinaryVector.Mutator) pci.vv.getMutator()) .setSafe(rowIndex, value, 0, value.remaining()); } else { ((VarBinaryVector.Mutator) pci.vv.getMutator())
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(NullableVarBinaryHolder h) { mutator.setSafe(idx(), h); vector.getMutator().setValueCount(idx()+1); }
public void write(VarBinaryHolder h) { mutator.setSafe(idx(), h); vector.getMutator().setValueCount(idx()+1); }
@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); } }