public QueryRanges getQueryRanges() { return new QueryRanges( new ByteArrayRange( NumericFieldIndexStrategy.toIndexByte(lowerValue.doubleValue()), NumericFieldIndexStrategy.toIndexByte(upperValue.doubleValue()))); }
public QueryRanges getQueryRanges() { return new QueryRanges( new ByteArrayRange( TemporalIndexStrategy.toIndexByte(start), TemporalIndexStrategy.toIndexByte(end))); }
public QueryRanges getQueryRanges() { // TODO case sensitivity return new QueryRanges( new ByteArrayRange( StringUtils.stringToBinary(matchValue), StringUtils.stringToBinary(matchValue))); }
public BaseRowPrefixQuery( final Index index, final byte[] partitionKey, final byte[] sortKeyPrefix, final ScanCallback<T, ?> scanCallback, final DifferingFieldVisibilityEntryCount differingVisibilityCounts, final FieldVisibilityCount visibilityCounts, final DataIndexRetrieval dataIndexRetrieval, final String[] authorizations) { super( index, authorizations, scanCallback, differingVisibilityCounts, visibilityCounts, dataIndexRetrieval); final ByteArrayRange sortKeyPrefixRange = new ByteArrayRange(sortKeyPrefix, sortKeyPrefix, false); final List<SinglePartitionQueryRanges> ranges = new ArrayList<>(); final Collection<ByteArrayRange> sortKeys = Collections.singleton(sortKeyPrefixRange); ranges.add(new SinglePartitionQueryRanges(partitionKey, sortKeys)); queryRanges = new QueryRanges(ranges); }
protected static void binFullRange( final Map<HRegionLocation, Map<HRegionInfo, List<ByteArrayRange>>> binnedRanges, final RegionLocator regionLocator) throws IOException { final List<HRegionLocation> locations = regionLocator.getAllRegionLocations(); for (final HRegionLocation location : locations) { Map<HRegionInfo, List<ByteArrayRange>> regionInfoMap = binnedRanges.get(location); if (regionInfoMap == null) { regionInfoMap = new HashMap<>(); binnedRanges.put(location, regionInfoMap); } final HRegionInfo regionInfo = location.getRegionInfo(); List<ByteArrayRange> rangeList = regionInfoMap.get(regionInfo); if (rangeList == null) { rangeList = new ArrayList<>(); regionInfoMap.put(regionInfo, rangeList); } final ByteArrayRange regionRange = new ByteArrayRange(regionInfo.getStartKey(), regionInfo.getEndKey()); rangeList.add(regionRange); } }
public ByteArrayRange union(final ByteArrayRange other) { return new ByteArrayRange( ByteArrayUtils.compare(start, other.start) <= 0 ? start : other.start, ByteArrayUtils.compare(getEndAsNextPrefix(), other.getEndAsNextPrefix()) >= 0 ? end : other.end); }
/ (nthPowerOfTwo - 1))); return new ByteArrayRange(min, max);
private CloseableIterator<T> createIteratorForRecordReader( final RocksDBClient client, final RecordReaderParams recordReaderParams) { final GeoWaveRowRange range = recordReaderParams.getRowRange(); final byte[] startKey = range.isInfiniteStartSortKey() ? null : range.getStartSortKey(); final byte[] stopKey = range.isInfiniteStopSortKey() ? null : range.getEndSortKey(); final SinglePartitionQueryRanges partitionRange = new SinglePartitionQueryRanges( range.getPartitionKey(), Collections.singleton(new ByteArrayRange(startKey, stopKey))); final Set<String> authorizations = Sets.newHashSet(recordReaderParams.getAdditionalAuthorizations()); return createIterator( client, (RangeReaderParams<T>) recordReaderParams, (GeoWaveRowIteratorTransformer<T>) GeoWaveRowIteratorTransformer.NO_OP_TRANSFORMER, Collections.singleton(partitionRange), authorizations, // there should already be sufficient parallelism created by // input splits for record reader use cases false); }
public ByteArrayRange intersection(final ByteArrayRange other) { return new ByteArrayRange( ByteArrayUtils.compare(start, other.start) <= 0 ? other.start : start, ByteArrayUtils.compare(getEndAsNextPrefix(), other.getEndAsNextPrefix()) >= 0 ? other.end : end); }
protected static GeoWaveRowRange rangeIntersection( final GeoWaveRowRange thisRange, final GeoWaveRowRange otherRange) { final ByteArrayRange thisByteArrayRange = new ByteArrayRange(thisRange.getStartSortKey(), thisRange.getEndSortKey()); final ByteArrayRange otherByteArrayRange = new ByteArrayRange(otherRange.getStartSortKey(), otherRange.getEndSortKey()); final ByteArrayRange overlappingRange = thisByteArrayRange.intersection(otherByteArrayRange); return new GeoWaveRowRange( null, overlappingRange.getStart(), overlappingRange.getEnd(), true, false); } }
/** * Always returns a single range since this is a 1-dimensional index. The sort-order of the bytes * is the same as the sort order of values, so an indexedRange can be represented by a single * contiguous ByteArrayRange. {@inheritDoc} */ @Override public QueryRanges getQueryRanges( final MultiDimensionalNumericData indexedRange, final int maxEstimatedRangeDecomposition, final IndexMetaData... hints) { final T min = cast(indexedRange.getMinValuesPerDimension()[0]); final byte[] start = lexicoder.toByteArray(min); final T max = cast(Math.ceil(indexedRange.getMaxValuesPerDimension()[0])); final byte[] end = lexicoder.toByteArray(max); final ByteArrayRange range = new ByteArrayRange(start, end); final SinglePartitionQueryRanges partitionRange = new SinglePartitionQueryRanges(Collections.singletonList(range)); return new QueryRanges(Collections.singletonList(partitionRange)); }
private CloseableIterator<T> createIteratorForRecordReader( final RedissonClient client, final Compression compression, final RecordReaderParams recordReaderParams, final String namespace, final boolean visibilityEnabled) { final GeoWaveRowRange range = recordReaderParams.getRowRange(); final byte[] startKey = range.isInfiniteStartSortKey() ? null : range.getStartSortKey(); final byte[] stopKey = range.isInfiniteStopSortKey() ? null : range.getEndSortKey(); final SinglePartitionQueryRanges partitionRange = new SinglePartitionQueryRanges( range.getPartitionKey(), Collections.singleton(new ByteArrayRange(startKey, stopKey))); final Set<String> authorizations = Sets.newHashSet(recordReaderParams.getAdditionalAuthorizations()); return createIterator( client, compression, (RangeReaderParams<T>) recordReaderParams, (GeoWaveRowIteratorTransformer<T>) GeoWaveRowIteratorTransformer.NO_OP_TRANSFORMER, namespace, Collections.singleton(partitionRange), authorizations, visibilityEnabled, // there should already be sufficient parallelism created by // input splits for record reader use cases false); }
false, false, new QueryRanges(new ByteArrayRange(sortKey, sortKey, false)), null, 1,
if ((partition.getSortKeyRanges() == null) || partition.getSortKeyRanges().isEmpty()) { internalQueryRanges.add( new ByteArrayRange(partition.getPartitionKey(), partition.getPartitionKey())); } else if (partition.getPartitionKey() == null) { internalQueryRanges.addAll(partition.getSortKeyRanges()); for (final ByteArrayRange sortKeyRange : partition.getSortKeyRanges()) { internalQueryRanges.add( new ByteArrayRange( ByteArrayUtils.combineArrays( partition.getPartitionKey(),
public static ByteArrayRange fromRowRange(final GeoWaveRowRange range) { if ((range.getPartitionKey() == null) || (range.getPartitionKey().length == 0)) { final byte[] startKey = (range.getStartSortKey() == null) ? null : range.getStartSortKey(); final byte[] endKey = (range.getEndSortKey() == null) ? null : range.getEndSortKey(); return new ByteArrayRange(startKey, endKey); } else { final byte[] startKey = (range.getStartSortKey() == null) ? range.getPartitionKey() : ArrayUtils.addAll(range.getPartitionKey(), range.getStartSortKey()); final byte[] endKey = (range.getEndSortKey() == null) ? ByteArrayUtils.getNextPrefix(range.getPartitionKey()) : ArrayUtils.addAll(range.getPartitionKey(), range.getEndSortKey()); return new ByteArrayRange(startKey, endKey); } }
public ByteArrayRange getSingleRange() { byte[] start = null; byte[] end = null; for (final ByteArrayRange range : sortKeyRanges) { if ((start == null) || (ByteArrayUtils.compare(range.getStart(), start) < 0)) { start = range.getStart(); } if ((end == null) || (ByteArrayUtils.compare(range.getEnd(), end) > 0)) { end = range.getEnd(); } } return new ByteArrayRange(start, end); } }
protected void initRecordScanner() { final short[] adapterIds = recordReaderParams.getAdapterIds() != null ? recordReaderParams.getAdapterIds() : new short[0]; final GeoWaveRowRange range = recordReaderParams.getRowRange(); final byte[] startKey = range.isInfiniteStartSortKey() ? null : range.getStartSortKey(); final byte[] stopKey = range.isInfiniteStopSortKey() ? null : range.getEndSortKey(); final SinglePartitionQueryRanges partitionRange = new SinglePartitionQueryRanges( range.getPartitionKey(), Collections.singleton(new ByteArrayRange(startKey, stopKey))); final Set<String> authorizations = Sets.newHashSet(recordReaderParams.getAdditionalAuthorizations()); iterator = operations.getBatchedRangeRead( recordReaderParams.getIndex().getName(), adapterIds, Collections.singleton(partitionRange), DataStoreUtils.isMergingIteratorRequired(recordReaderParams, visibilityEnabled), rowTransformer, new ClientVisibilityFilter(authorizations)).results(); }
public static ByteArrayRange getSingleRange(final List<ByteArrayRange> ranges) { byte[] start = null; byte[] end = null; if (ranges == null) { return null; } for (final ByteArrayRange range : ranges) { if ((start == null) || (ByteArrayUtils.compare(range.getStart(), start) < 0)) { start = range.getStart(); } if ((end == null) || (ByteArrayUtils.compare(range.getEnd(), end) > 0)) { end = range.getEnd(); } } return new ByteArrayRange(start, end); } }
protected void initRecordScanner() { final String tableName = operations.getQualifiedTableName(recordReaderParams.getIndex().getName()); final ArrayList<Short> adapterIds = Lists.newArrayList(); if ((recordReaderParams.getAdapterIds() != null) && (recordReaderParams.getAdapterIds().length > 0)) { for (final Short adapterId : recordReaderParams.getAdapterIds()) { adapterIds.add(adapterId); } } final List<QueryRequest> requests = new ArrayList<>(); final GeoWaveRowRange range = recordReaderParams.getRowRange(); for (final Short adapterId : adapterIds) { final byte[] startKey = range.isInfiniteStartSortKey() ? null : range.getStartSortKey(); final byte[] stopKey = range.isInfiniteStopSortKey() ? null : range.getEndSortKey(); requests.add( getQuery( tableName, range.getPartitionKey(), new ByteArrayRange(startKey, stopKey), adapterId)); } startRead(requests, tableName, recordReaderParams.isClientsideRowMerging(), false); }
/** * {@inheritDoc} */ @Override public RangeDecomposition decomposeRange( final MultiDimensionalNumericData query, final boolean overInclusiveOnEdge, final int maxFilteredIndexedRanges) { // TODO: Because the research and benchmarking show Hilbert to // outperform Z-Order // the optimization of full query decomposition is not implemented at // the moment for Z-Order final double[] queryMins = query.getMinValuesPerDimension(); final double[] queryMaxes = query.getMaxValuesPerDimension(); final double[] normalizedMins = new double[query.getDimensionCount()]; final double[] normalizedMaxes = new double[query.getDimensionCount()]; for (int d = 0; d < query.getDimensionCount(); d++) { normalizedMins[d] = dimensionDefs[d].normalize(queryMins[d]); normalizedMaxes[d] = dimensionDefs[d].normalize(queryMaxes[d]); } final byte[] minZorder = ZOrderUtils.encode(normalizedMins, cardinalityPerDimension, query.getDimensionCount()); final byte[] maxZorder = ZOrderUtils.encode(normalizedMaxes, cardinalityPerDimension, query.getDimensionCount()); return new RangeDecomposition(new ByteArrayRange[] {new ByteArrayRange(minZorder, maxZorder)}); }