public Object getFieldValue(_Fields field) { switch (field) { case VALUES: return getValues(); } throw new IllegalStateException(); }
/** * Constructor of ColumnDictionaryChunkIterator * * @param columnDictionaryChunks */ public ColumnDictionaryChunkIterator(List<ColumnDictionaryChunk> columnDictionaryChunks) { this.columnDictionaryChunks = columnDictionaryChunks; for (ColumnDictionaryChunk dictionaryChunk : columnDictionaryChunks) { this.size += dictionaryChunk.getValues().size(); } }
/** * Returns the next element in the iteration. * The method pics the next elements from the first inner list till first is not finished, pics * the second inner list ... * * @return the next element in the iteration */ @Override public byte[] next() { if (iteratorIndex >= columnDictionaryChunks.get(outerIndex).getValues().size()) { iteratorIndex = 0; outerIndex++; } ByteBuffer buffer = columnDictionaryChunks.get(outerIndex).getValues().get(iteratorIndex); byte[] value = buffer.array(); currentSize++; iteratorIndex++; return value; } }
/** * This method will put all the dictionary chunks into one list and return that list * * @param columnDictionaryChunks * @return */ private List<byte[]> getDictionaryList(List<ColumnDictionaryChunk> columnDictionaryChunks) { int dictionaryListSize = 0; for (ColumnDictionaryChunk dictionaryChunk : columnDictionaryChunks) { dictionaryListSize = dictionaryListSize + dictionaryChunk.getValues().size(); } // convert byte buffer list to byte array list of dictionary values List<byte[]> dictionaryValues = new ArrayList<byte[]>(dictionaryListSize); for (ColumnDictionaryChunk dictionaryChunk : columnDictionaryChunks) { convertAndFillByteBufferListToByteArrayList(dictionaryValues, dictionaryChunk.getValues()); } return dictionaryValues; }