Search in sources :

Example 1 with BinnedNumericDataset

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);
    }
}
Also used : MultiDimensionalNumericData(org.locationtech.geowave.core.index.numeric.MultiDimensionalNumericData) BinnedNumericDataset(org.locationtech.geowave.core.index.numeric.BinnedNumericDataset) ByteArray(org.locationtech.geowave.core.index.ByteArray)

Example 2 with BinnedNumericDataset

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;
}
Also used : BinnedNumericDataset(org.locationtech.geowave.core.index.numeric.BinnedNumericDataset) SinglePartitionQueryRanges(org.locationtech.geowave.core.index.SinglePartitionQueryRanges) ArrayList(java.util.ArrayList) RangeDecomposition(org.locationtech.geowave.core.index.sfc.RangeDecomposition)

Example 3 with BinnedNumericDataset

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);
}
Also used : BinnedNumericDataset(org.locationtech.geowave.core.index.numeric.BinnedNumericDataset) SinglePartitionInsertionIds(org.locationtech.geowave.core.index.SinglePartitionInsertionIds) SinglePartitionInsertionIds(org.locationtech.geowave.core.index.SinglePartitionInsertionIds) InsertionIds(org.locationtech.geowave.core.index.InsertionIds) HashSet(java.util.HashSet)

Example 4 with BinnedNumericDataset

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);
}
Also used : BinnedNumericDataset(org.locationtech.geowave.core.index.numeric.BinnedNumericDataset) SinglePartitionInsertionIds(org.locationtech.geowave.core.index.SinglePartitionInsertionIds) SinglePartitionInsertionIds(org.locationtech.geowave.core.index.SinglePartitionInsertionIds) InsertionIds(org.locationtech.geowave.core.index.InsertionIds) HashSet(java.util.HashSet)

Example 5 with BinnedNumericDataset

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);
}
Also used : MultiDimensionalNumericData(org.locationtech.geowave.core.index.numeric.MultiDimensionalNumericData) BinnedNumericDataset(org.locationtech.geowave.core.index.numeric.BinnedNumericDataset) SinglePartitionInsertionIds(org.locationtech.geowave.core.index.SinglePartitionInsertionIds) SinglePartitionInsertionIds(org.locationtech.geowave.core.index.SinglePartitionInsertionIds) InsertionIds(org.locationtech.geowave.core.index.InsertionIds) HashSet(java.util.HashSet)

Aggregations

BinnedNumericDataset (org.locationtech.geowave.core.index.numeric.BinnedNumericDataset)9 InsertionIds (org.locationtech.geowave.core.index.InsertionIds)5 SinglePartitionInsertionIds (org.locationtech.geowave.core.index.SinglePartitionInsertionIds)5 ArrayList (java.util.ArrayList)4 HashSet (java.util.HashSet)4 SinglePartitionQueryRanges (org.locationtech.geowave.core.index.SinglePartitionQueryRanges)3 QueryRanges (org.locationtech.geowave.core.index.QueryRanges)2 MultiDimensionalNumericData (org.locationtech.geowave.core.index.numeric.MultiDimensionalNumericData)2 BigInteger (java.math.BigInteger)1 ByteArray (org.locationtech.geowave.core.index.ByteArray)1 RangeDecomposition (org.locationtech.geowave.core.index.sfc.RangeDecomposition)1 SpaceFillingCurve (org.locationtech.geowave.core.index.sfc.SpaceFillingCurve)1 TierIndexMetaData (org.locationtech.geowave.core.index.sfc.tiered.TieredSFCIndexStrategy.TierIndexMetaData)1