use of org.locationtech.geowave.core.store.entities.GeoWaveKeyImpl in project geowave by locationtech.
the class AccumuloReader method entryRowIdsMatch.
private boolean entryRowIdsMatch(final Entry<Key, Value> nextEntry, final Entry<Key, Value> peekedEntry) {
final GeoWaveKey nextKey = new GeoWaveKeyImpl(nextEntry.getKey().getRow().copyBytes(), partitionKeyLength);
final GeoWaveKey peekedKey = new GeoWaveKeyImpl(peekedEntry.getKey().getRow().copyBytes(), partitionKeyLength);
return DataStoreUtils.rowIdsMatch(nextKey, peekedKey);
}
use of org.locationtech.geowave.core.store.entities.GeoWaveKeyImpl in project geowave by locationtech.
the class NumericIndexStrategyFilterIterator method inBounds.
private boolean inBounds(final Key k) {
k.getRow(row);
final GeoWaveKeyImpl key = new GeoWaveKeyImpl(row.getBytes(), partitionKeyLength, row.getLength());
final MultiDimensionalCoordinates coordinates = indexStrategy.getCoordinatesPerDimension(key.getPartitionKey(), key.getSortKey());
if (coordinates == null) {
// this is a filter, so caution should be on the side of accepting values that can't be parsed
return true;
}
return rangeCache.inBounds(coordinates);
}
use of org.locationtech.geowave.core.store.entities.GeoWaveKeyImpl in project geowave by locationtech.
the class DynamoDBRow method getGeoWaveKey.
private static GeoWaveKey getGeoWaveKey(final Map<String, AttributeValue> objMap) {
final byte[] partitionKey = objMap.get(GW_PARTITION_ID_KEY).getB().array();
final byte[] rangeKey = objMap.get(GW_RANGE_KEY).getB().array();
final int length = rangeKey.length;
final ByteBuffer metadataBuf = ByteBuffer.wrap(rangeKey, length - 8, 8);
final int dataIdLength = metadataBuf.getInt();
final int numberOfDuplicates = metadataBuf.getInt();
final ByteBuffer buf = ByteBuffer.wrap(rangeKey, 0, length - 16);
final byte[] sortKey = new byte[length - 16 - 2 - dataIdLength];
final byte[] dataId = new byte[dataIdLength];
// Range key (row ID) = adapterId + sortKey + dataId
final byte[] internalAdapterIdBytes = new byte[2];
buf.get(internalAdapterIdBytes);
final short internalAdapterId = ByteArrayUtils.byteArrayToShort(internalAdapterIdBytes);
buf.get(sortKey);
buf.get(dataId);
return new GeoWaveKeyImpl(dataId, internalAdapterId, Arrays.equals(DynamoDBUtils.EMPTY_PARTITION_KEY, partitionKey) ? new byte[0] : partitionKey, DynamoDBUtils.decodeSortableBase64(sortKey), numberOfDuplicates);
}
use of org.locationtech.geowave.core.store.entities.GeoWaveKeyImpl in project geowave by locationtech.
the class RasterTileResizeMapper method mapNativeValue.
@Override
protected void mapNativeValue(final GeoWaveInputKey key, final GridCoverage value, final MapContext<GeoWaveInputKey, GridCoverage, GeoWaveInputKey, Object> context) throws IOException, InterruptedException {
if (helper.isOriginalCoverage(key.getInternalAdapterId())) {
final InternalDataAdapter<?> adapter = super.serializationTool.getInternalAdapter(key.getInternalAdapterId());
if ((adapter != null) && (adapter.getAdapter() != null) && (adapter.getAdapter() instanceof RasterDataAdapter)) {
final Iterator<GridCoverage> coverages = helper.getCoveragesForIndex(value);
if (coverages == null) {
LOGGER.error("Couldn't get coverages instance, getCoveragesForIndex returned null");
throw new IOException("Couldn't get coverages instance, getCoveragesForIndex returned null");
}
while (coverages.hasNext()) {
final GridCoverage c = coverages.next();
// converted above
if (c instanceof FitToIndexGridCoverage) {
final byte[] partitionKey = ((FitToIndexGridCoverage) c).getPartitionKey();
final byte[] sortKey = ((FitToIndexGridCoverage) c).getSortKey();
final GeoWaveKey geowaveKey = new GeoWaveKeyImpl(helper.getNewDataId(c), key.getInternalAdapterId(), partitionKey, sortKey, 0);
final GeoWaveInputKey inputKey = new GeoWaveInputKey(helper.getNewAdapterId(), geowaveKey, helper.getIndexName());
context.write(inputKey, c);
}
}
}
}
}
use of org.locationtech.geowave.core.store.entities.GeoWaveKeyImpl in project geowave by locationtech.
the class DataStoreUtils method mergeSingleRowValues.
public static GeoWaveRow mergeSingleRowValues(final GeoWaveRow singleRow, final RowTransform rowTransform) {
if (singleRow.getFieldValues().length < 2) {
return singleRow;
}
// merge all values into a single value
Mergeable merged = null;
for (final GeoWaveValue fieldValue : singleRow.getFieldValues()) {
final Mergeable mergeable = rowTransform.getRowAsMergeableObject(singleRow.getAdapterId(), new ByteArray(fieldValue.getFieldMask()), fieldValue.getValue());
if (merged == null) {
merged = mergeable;
} else {
merged.merge(mergeable);
}
}
final GeoWaveValue[] mergedFieldValues = new GeoWaveValue[] { new GeoWaveValueImpl(singleRow.getFieldValues()[0].getFieldMask(), singleRow.getFieldValues()[0].getVisibility(), rowTransform.getBinaryFromMergedObject(merged)) };
return new GeoWaveRowImpl(new GeoWaveKeyImpl(singleRow.getDataId(), singleRow.getAdapterId(), singleRow.getPartitionKey(), singleRow.getSortKey(), singleRow.getNumberOfDuplicates()), mergedFieldValues);
}
Aggregations