protected SplitsProvider createSplitsProvider() { return new SplitsProvider(); }
protected static byte[] extractBytes( final byte[] seq, final int numBytes, final boolean infiniteEndKey) { final byte[] bytes = new byte[numBytes + 2]; bytes[0] = 1; bytes[1] = 0; for (int i = 0; i < numBytes; i++) { if (i >= seq.length) { if (infiniteEndKey) { // -1 is 0xff bytes[i + 2] = -1; } else { bytes[i + 2] = 0; } } else { bytes[i + 2] = seq[i]; } } return bytes; }
getPartitionStats(index, adapterIds, statsStore, authorizations); new GeoWaveRowRange(partitionKey.getBytes(), null, null, true, true); final double cardinality = getCardinality( getHistStats( index, adapterIds, final GeoWaveRowRange gwRange = SplitsProvider.toRowRange(range, partitionKeyLength); getCardinality( getHistStats( index, adapterIds,
protected RowRangeHistogramStatistics<?> getHistStats( final Index index, final List<Short> adapterIds, final TransientAdapterStore adapterStore, final DataStatisticsStore statsStore, final Map<Pair<Index, ByteArray>, RowRangeHistogramStatistics<?>> statsCache, final ByteArray partitionKey, final String[] authorizations) throws IOException { Pair<Index, ByteArray> key = Pair.of(index, partitionKey); RowRangeHistogramStatistics<?> rangeStats = statsCache.get(key); if (rangeStats == null) { try { rangeStats = getRangeStats( index, adapterIds, adapterStore, statsStore, partitionKey, authorizations); if (rangeStats != null) { statsCache.put(key, rangeStats); } } catch (final Exception e) { throw new IOException(e); } } return rangeStats; }
if (result == 0) { for (final RangeLocationPair p : pairs) { rangeSum += SplitsProvider.getRangeLength(p.getRange()); otherSum += SplitsProvider.getRangeLength(p.getRange());
protected void initRecordScanner() { final FilterList filterList = new FilterList(); final ByteArrayRange range = SplitsProvider.fromRowRange(recordReaderParams.getRowRange());
if (((start != null) && (new ByteArray(start).compareTo(new ByteArray(splitKey)) >= 0)) || ((end != null) && (new ByteArray(end).compareTo(new ByteArray(splitKey)) <= 0))) { splitKey = SplitsProvider.getMidpoint(rangeLocationPair.getRange()); if (splitKey == null) { return null;
private static float getProgressForRange( final byte[] start, final byte[] end, final byte[] position) { final int maxDepth = Math.min(Math.max(end.length, start.length), position.length); final BigInteger startBI = new BigInteger(SplitsProvider.extractBytes(start, maxDepth)); final BigInteger endBI = new BigInteger(SplitsProvider.extractBytes(end, maxDepth)); final BigInteger positionBI = new BigInteger(SplitsProvider.extractBytes(position, maxDepth)); return (float) (positionBI.subtract(startBI).doubleValue() / endBI.subtract(startBI).doubleValue()); }
protected static BigInteger getStart(final GeoWaveRowRange range, final int cardinality) { final byte[] start = range.getStartSortKey(); byte[] startBytes; if (!range.isInfiniteStartSortKey() && (start != null)) { startBytes = extractBytes(start, cardinality); } else { startBytes = extractBytes(new byte[] {}, cardinality); } return new BigInteger(startBytes); }
protected static BigInteger getEnd(final GeoWaveRowRange range, final int cardinality) { final byte[] end = range.getEndSortKey(); byte[] endBytes; if (!range.isInfiniteStopSortKey() && (end != null)) { endBytes = extractBytes(end, cardinality); } else { endBytes = extractBytes(new byte[] {}, cardinality, true); } return new BigInteger(endBytes); }
protected static double getRangeLength(final GeoWaveRowRange range) { if ((range == null) || (range.getStartSortKey() == null) || (range.getEndSortKey() == null)) { return 1; } final byte[] start = range.getStartSortKey(); final byte[] end = range.getEndSortKey(); final int maxDepth = Math.max(end.length, start.length); final BigInteger startBI = new BigInteger(extractBytes(start, maxDepth)); final BigInteger endBI = new BigInteger(extractBytes(end, maxDepth)); return endBI.subtract(startBI).doubleValue(); }
protected static byte[] getMidpoint(final GeoWaveRowRange range) { if ((range.getStartSortKey() == null) || (range.getEndSortKey() == null)) { return null; } final byte[] start = range.getStartSortKey(); final byte[] end = range.getEndSortKey(); if (Arrays.equals(start, end)) { return null; } final int maxDepth = Math.max(end.length, start.length); final BigInteger startBI = new BigInteger(extractBytes(start, maxDepth)); final BigInteger endBI = new BigInteger(extractBytes(end, maxDepth)); final BigInteger rangeBI = endBI.subtract(startBI); if (rangeBI.equals(BigInteger.ZERO) || rangeBI.equals(BigInteger.ONE)) { return end; } final byte[] valueBytes = rangeBI.divide(TWO).add(startBI).toByteArray(); final byte[] bytes = new byte[valueBytes.length - 2]; System.arraycopy(valueBytes, 2, bytes, 0, bytes.length); return bytes; }