partialQuery = query.withQuerySegmentSpec(new MultipleSpecificSegmentSpec(Lists.newArrayList(newSD))) .withPagingSpec(PagingSpec.newSpec(Integer.MAX_VALUE)); splits[i] = new HiveDruidSplit(DruidStorageHandlerUtils.JSON_MAPPER.writeValueAsString(partialQuery), dummyPath, hosts);
private boolean checkPagingSpec(PagingSpec pagingSpec, boolean descending) { for (Integer value : pagingSpec.getPagingIdentifiers().values()) { if (descending ^ (value < 0)) { return false; } } return pagingSpec.getThreshold() >= 0; }
@Override protected Queue<EventHolder> instantiatePQueue() { int threshold = pagingSpec.getThreshold(); return MinMaxPriorityQueue.orderedBy(descending ? Comparators.inverse(comparator) : comparator) .maximumSize(threshold > 0 ? threshold : Integer.MAX_VALUE) .create(); }
+ query.getPagingSpec().getCacheKey().length + dimensionsBytesSize + metricBytesSize
public static PagingSpec newSpec(int threshold) { return new PagingSpec(null, threshold); }
public PagingOffset getPagingOffset(String identifier) { return pagingSpec.getOffset(identifier, isDescending()); }
@Override public int hashCode() { int result = super.hashCode(); result = 31 * result + (dimFilter != null ? dimFilter.hashCode() : 0); result = 31 * result + (dimensions != null ? dimensions.hashCode() : 0); result = 31 * result + (metrics != null ? metrics.hashCode() : 0); result = 31 * result + (virtualColumns != null ? virtualColumns.hashCode() : 0); result = 31 * result + (pagingSpec != null ? pagingSpec.hashCode() : 0); return result; } }
public byte[] getCacheKey() { final byte[][] pagingKeys = new byte[pagingIdentifiers.size()][]; final byte[][] pagingValues = new byte[pagingIdentifiers.size()][]; int index = 0; int pagingKeysSize = 0; int pagingValuesSize = 0; for (Map.Entry<String, Integer> entry : pagingIdentifiers.entrySet()) { pagingKeys[index] = StringUtils.toUtf8(entry.getKey()); pagingValues[index] = ByteBuffer.allocate(Ints.BYTES).putInt(entry.getValue()).array(); pagingKeysSize += pagingKeys[index].length; pagingValuesSize += Ints.BYTES; index++; } final byte[] thresholdBytes = ByteBuffer.allocate(Ints.BYTES).putInt(threshold).array(); final ByteBuffer queryCacheKey = ByteBuffer.allocate(pagingKeysSize + pagingValuesSize + thresholdBytes.length + 1); for (byte[] pagingKey : pagingKeys) { queryCacheKey.put(pagingKey); } for (byte[] pagingValue : pagingValues) { queryCacheKey.put(pagingValue); } queryCacheKey.put(thresholdBytes); queryCacheKey.put(isFromNext() ? (byte) 0x01 : 0x00); return queryCacheKey.array(); }
Map<String, Integer> paging = pagingSpec.getPagingIdentifiers(); if (paging == null || paging.isEmpty()) { return segments;
: gran.toDateTime(gran.truncate(arg1.getTimestamp().getMillis())); SelectResultValueBuilder builder = new SelectResultValueBuilder(timestamp, pagingSpec.getThreshold());
+ query.getPagingSpec().getCacheKey().length + dimensionsBytesSize + metricBytesSize .put(granularityBytes) .put(filterBytes) .put(query.getPagingSpec().getCacheKey()) .put(isDescendingByte);