use of org.locationtech.geowave.core.index.numeric.BinnedNumericDataset in project geowave by locationtech.
the class BasicQueryFilter method init.
private void init(final MultiDimensionalNumericData constraints, final NumericDimensionField<?>[] dimensionFields) {
this.dimensionFields = dimensionFields;
binnedConstraints = new HashMap<>();
this.constraints = constraints;
final List<BinnedNumericDataset> queries = BinnedNumericDataset.applyBins(constraints, dimensionFields);
for (final BinnedNumericDataset q : queries) {
final ByteArray binId = new ByteArray(q.getBinId());
List<MultiDimensionalNumericData> ranges = binnedConstraints.get(binId);
if (ranges == null) {
ranges = new ArrayList<>();
binnedConstraints.put(binId, ranges);
}
ranges.add(q);
}
}
use of org.locationtech.geowave.core.index.numeric.BinnedNumericDataset in project geowave by locationtech.
the class BinnedSFCUtils method getQueryRanges.
public static List<SinglePartitionQueryRanges> getQueryRanges(final List<BinnedNumericDataset> binnedQueries, final SpaceFillingCurve sfc, final int maxRanges, final Byte tier) {
final List<SinglePartitionQueryRanges> queryRanges = new ArrayList<>();
int maxRangeDecompositionPerBin = maxRanges;
if ((maxRanges > 1) && (binnedQueries.size() > 1)) {
maxRangeDecompositionPerBin = (int) Math.ceil((double) maxRanges / (double) binnedQueries.size());
}
for (final BinnedNumericDataset binnedQuery : binnedQueries) {
final RangeDecomposition rangeDecomp = sfc.decomposeRange(binnedQuery, true, maxRangeDecompositionPerBin);
final byte[] tierAndBinId = tier != null ? ByteArrayUtils.combineArrays(new byte[] { tier // we're assuming tiers only go to 127 (the max byte
// value)
}, binnedQuery.getBinId()) : binnedQuery.getBinId();
queryRanges.add(new SinglePartitionQueryRanges(tierAndBinId, Arrays.asList(rangeDecomp.getRanges())));
}
return queryRanges;
}
use of org.locationtech.geowave.core.index.numeric.BinnedNumericDataset in project geowave by locationtech.
the class SingleTierSubStrategy method getInsertionIds.
@Override
public InsertionIds getInsertionIds(final MultiDimensionalNumericData indexedData, final int maxDuplicateInsertionIds) {
if (indexedData.isEmpty()) {
LOGGER.warn("Cannot index empty fields, skipping writing row to index '" + getId() + "'");
return new InsertionIds();
}
// we need to duplicate per bin so we can't adhere to max duplication
// anyways
final List<BinnedNumericDataset> ranges = BinnedNumericDataset.applyBins(indexedData, baseDefinitions);
final Set<SinglePartitionInsertionIds> retVal = new HashSet<>(ranges.size());
for (final BinnedNumericDataset range : ranges) {
final SinglePartitionInsertionIds binRowIds = TieredSFCIndexStrategy.getRowIdsAtTier(range, tier, sfc, null, tier);
if (binRowIds != null) {
retVal.add(binRowIds);
}
}
return new InsertionIds(retVal);
}
use of org.locationtech.geowave.core.index.numeric.BinnedNumericDataset in project geowave by locationtech.
the class TieredSFCIndexStrategy method internalGetInsertionIds.
private InsertionIds internalGetInsertionIds(final MultiDimensionalNumericData indexedData, final BigInteger maxDuplicateInsertionIds) {
if (indexedData.isEmpty()) {
LOGGER.warn("Cannot index empty fields, skipping writing row to index '" + getId() + "'");
return new InsertionIds();
}
final List<BinnedNumericDataset> ranges = BinnedNumericDataset.applyBins(indexedData, baseDefinitions);
// place each of these indices into a single row ID at a tier that will
// fit its min and max
final Set<SinglePartitionInsertionIds> retVal = new HashSet<>(ranges.size());
for (final BinnedNumericDataset range : ranges) {
retVal.add(getRowIds(range, maxDuplicateInsertionIds));
}
return new InsertionIds(retVal);
}
use of org.locationtech.geowave.core.index.numeric.BinnedNumericDataset in project geowave by locationtech.
the class TieredSFCIndexStrategy method reprojectToTier.
public InsertionIds reprojectToTier(final byte[] insertId, final Byte reprojectTierId, final BigInteger maxDuplicates) {
final MultiDimensionalNumericData originalRange = getRangeForId(insertId, null);
final List<BinnedNumericDataset> ranges = BinnedNumericDataset.applyBins(originalRange, baseDefinitions);
final int sfcIndex = orderedSfcIndexToTierId.inverse().get(reprojectTierId);
final Set<SinglePartitionInsertionIds> retVal = new HashSet<>(ranges.size());
for (final BinnedNumericDataset reprojectRange : ranges) {
final SinglePartitionInsertionIds tierIds = TieredSFCIndexStrategy.getRowIdsAtTier(reprojectRange, reprojectTierId, orderedSfcs[sfcIndex], maxDuplicates, sfcIndex);
retVal.add(tierIds);
}
return new InsertionIds(retVal);
}
Aggregations