private void setStringColumnValue(String data, ProjectedColumnInfo pci, int rowCount) { if (data == null) { data = "null"; } ByteBuffer value = ByteBuffer.wrap(data.getBytes(UTF_8)); ((NullableVarCharVector.Mutator) pci.vv.getMutator()) .setSafe(rowCount, value, 0, value.remaining()); }
@Override public void populatePartitionVectors(ValueVector[] vectors, List<PartitionLocation> partitions, BitSet partitionColumnBitSet, Map<Integer, String> fieldNameMap) { int record = 0; for (PartitionLocation partitionLocation: partitions) { for (int partitionColumnIndex : BitSets.toIter(partitionColumnBitSet)) { if (partitionLocation.getPartitionValue(partitionColumnIndex) == null) { // set null if dirX does not exist for the location. ((NullableVarCharVector) vectors[partitionColumnIndex]).getMutator().setNull(record); } else { byte[] bytes = (partitionLocation.getPartitionValue(partitionColumnIndex)).getBytes(Charsets.UTF_8); ((NullableVarCharVector) vectors[partitionColumnIndex]).getMutator().setSafe(record, bytes, 0, bytes.length); } } record++; } for (ValueVector v : vectors) { if (v == null) { continue; } v.getMutator().setValueCount(partitions.size()); } }
private void populateImplicitVectors(Map<String, String> implicitValues, int recordCount) { if (implicitValues != null) { for (Map.Entry<String, String> entry : implicitValues.entrySet()) { @SuppressWarnings("resource") final NullableVarCharVector v = (NullableVarCharVector) implicitFieldVectorMap.get(entry.getKey()); String val; if ((val = entry.getValue()) != null) { AllocationHelper.allocate(v, recordCount, val.length()); final byte[] bytes = val.getBytes(); for (int j = 0; j < recordCount; j++) { v.getMutator().setSafe(j, bytes, 0, bytes.length); } v.getMutator().setValueCount(recordCount); } else { AllocationHelper.allocate(v, recordCount, 0); v.getMutator().setValueCount(recordCount); } } } } }
static void setNullableStringColumnValue(final String data, final ValueVector vv, final int count) { ((NullableVarCharVector.Mutator) vv.getMutator()) .setSafe(count, data.getBytes(UTF_8), 0, data.length()); }
@Override public boolean setSafe(int index, DrillBuf value, int start, int length) { if (index >= vector.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 writeNull() { mutator.setNull(idx()); vector.getMutator().setValueCount(idx() + 1); }
public void setSafe(int index, NullableVarCharHolder holder) { setType(index, MinorType.VARCHAR); getVarCharVector().getMutator().setSafe(index, holder); }
public void write(NullableVarCharHolder h) { mutator.setSafe(idx(), h); vector.getMutator().setValueCount(idx()+1); }
public void write(VarCharHolder h) { mutator.setSafe(idx(), h); vector.getMutator().setValueCount(idx()+1); }
public void setSafe(int index, int isSet, int startField, int endField, DrillBuf bufferField ) { if (index > lastSet + 1) { fillEmpties(index); } bits.getMutator().setSafe(index, isSet); values.getMutator().setSafe(index, startField, endField, bufferField); setCount++; lastSet = index; }
public void setSafe(int index, byte[] value, int start, int length) { if (index > lastSet + 1) { fillEmpties(index); } bits.getMutator().setSafe(index, 1); values.getMutator().setSafe(index, value, start, length); setCount++; lastSet = index; }
/** {@inheritDoc} */ @Override protected void setSafe(VarLenBulkInput<VarLenBulkEntry> bulkInput) { mutator.setSafe(bulkInput); }
@Override public void load(int rowIndex, String value) { mutator.set(rowIndex, value.getBytes()); } }
public void writeVarChar(int start, int end, DrillBuf buffer) { mutator.setSafe(idx(), 1, start, end, buffer); vector.getMutator().setValueCount(idx() + 1); }
public void setSafe(int index, VarCharHolder value) { if (index > lastSet + 1) { fillEmpties(index); } bits.getMutator().setSafe(index, 1); values.getMutator().setSafe(index, value); setCount++; lastSet = index; }
public void setSafe(int index, NullableVarCharHolder value) { if (index > lastSet + 1) { fillEmpties(index); } bits.getMutator().setSafe(index, value.isSet); values.getMutator().setSafe(index, value); setCount++; lastSet = index; }
public void writeString(String s, int outboundIndex) { holder.isSet = 1; byte[] bytes = s.getBytes(Charsets.UTF_8); ensureLength(bytes.length); data.clear(); data.writeBytes(bytes); holder.buffer = data; holder.start = 0; holder.end = bytes.length; vector.getMutator().setSafe(outboundIndex, holder); } }
@Override public void setValueCount(int valueCount) { assert valueCount >= 0; fillEmpties(valueCount); values.getMutator().setValueCount(valueCount); bits.getMutator().setValueCount(valueCount); } /** Enables this wrapper container class to participate in bulk mutator logic */
public void copyFrom(int fromIndex, int thisIndex, NullableVarCharVector from){ final Accessor fromAccessor = from.getAccessor(); if (!fromAccessor.isNull(fromIndex)) { mutator.set(thisIndex, fromAccessor.get(fromIndex)); } }