/** * Get the element at the specified position. * * @param index position of the value * @return value of the element, if not null * @throws IllegalStateException if the value is null */ public byte[] get(int index) { if (isNull(index)) { throw new IllegalStateException("Can't get a null value"); } return vAccessor.get(index); }
public static String stringAt(VarCharVector vector, int i) { return new String(vector.getAccessor().get(i), Charsets.UTF_8); }
public static void checkIndexStrings(String prefix, int offset, int size, VarCharVector.Accessor accessor) { for (int index = offset; index < size; index++) { final String indexString = prefix + "String num " + index; Assert.assertArrayEquals(indexString.getBytes(), accessor.get(index)); } } }
public void get(int index, int positionIndex, NullableVarCharHolder holder) { final int offset = offsets.getAccessor().get(index); assert offset >= 0; if (positionIndex >= getInnerValueCountAt(index)) { holder.isSet = 0; return; } values.getAccessor().get(offset + positionIndex, holder); } }
public void get(int index, int positionIndex, VarCharHolder holder) { final int offset = offsets.getAccessor().get(index); assert offset >= 0; assert positionIndex < getInnerValueCountAt(index); values.getAccessor().get(offset + positionIndex, holder); }
String in = new String(str1V.getAccessor().get(i), Charsets.UTF_8); String upper = new String(upperStr1V.getAccessor().get(i), Charsets.UTF_8); assertTrue(in.toUpperCase().equals(upper));
String str1 = new String(str1V.getAccessor().get(i), Charsets.UTF_8); long str1Length = str1LengthV.getAccessor().get(i); assertTrue(str1.length() == str1Length);
protected Object[] getRunResult(QueryType queryType, String planString) throws Exception { List<QueryDataBatch> resultList = testRunAndReturn(queryType, planString); List<Object> res = new ArrayList<Object>(); RecordBatchLoader loader = new RecordBatchLoader(getAllocator()); for(QueryDataBatch result : resultList) { if (result.getData() != null) { loader.load(result.getHeader().getDef(), result.getData()); ValueVector v = loader.iterator().next().getValueVector(); for (int j = 0; j < v.getAccessor().getValueCount(); j++) { if (v instanceof VarCharVector) { res.add(new String(((VarCharVector) v).getAccessor().get(j))); } else { res.add(v.getAccessor().getObject(j)); } } loader.clear(); result.release(); } } return res.toArray(); }
public void read(VarCharHolder h) { vector.getAccessor().get(idx(), h); }
public void read(NullableVarCharHolder h) { vector.getAccessor().get(idx(), h); }
public void get(int index, NullableVarCharHolder holder){ vAccessor.get(index, holder); holder.isSet = bAccessor.get(index); }
@Override public boolean next() { if(index + 1 < repeatedHolder.end) { index++; repeatedHolder.vector.getAccessor().get(repeatedHolder.start + index, holder); return true; } else { return false; } }
public void add(int index, RepeatedVarCharHolder holder) { final VarCharVector.Accessor accessor = holder.vector.getAccessor(); final VarCharHolder innerHolder = new VarCharHolder(); for(int i = holder.start; i < holder.end; i++) { accessor.get(i, innerHolder); add(index, innerHolder); } }
public void get(int index, int positionIndex, VarCharHolder holder) { final int offset = offsets.getAccessor().get(index); assert offset >= 0; assert positionIndex < getInnerValueCountAt(index); values.getAccessor().get(offset + positionIndex, holder); }
@Override public Text getObject(int index) { Text text = new Text(); text.set(get(index)); return text; }
public void setSafe(int index, RepeatedVarCharHolder h) { final VarCharHolder ih = new VarCharHolder(); final VarCharVector.Accessor hVectorAccessor = h.vector.getAccessor(); mutator.startNewValue(index); for(int i = h.start; i < h.end; i++){ hVectorAccessor.get(i, ih); mutator.addSafe(index, ih); } }
public void get(int index, int positionIndex, NullableVarCharHolder holder) { final int offset = offsets.getAccessor().get(index); assert offset >= 0; if (positionIndex >= getInnerValueCountAt(index)) { holder.isSet = 0; return; } values.getAccessor().get(offset + positionIndex, holder); } }
/** * Get a value for the given record. Each element in the repeated field is accessed by * the positionIndex param. * * @param index record containing the repeated field * @param positionIndex position within the repeated field * @return element at the given position in the given record */ public byte[] get(int index, int positionIndex) { return values.getAccessor().get(offsets.getAccessor().get(index) + positionIndex); }