public PersistentDataset(final String fieldName, final T value) { this(); addValue(fieldName, value); }
public DeferredReadCommonIndexedPersistenceEncoding( final short adapterId, final byte[] dataId, final byte[] partitionKey, final byte[] sortKey, final int duplicateCount, final PersistentDataset<CommonIndexValue> commonData, final FlattenedUnreadData unreadData) { super( adapterId, dataId, partitionKey, sortKey, duplicateCount, commonData, new PersistentDataset<byte[]>(), new PersistentDataset<>()); this.unreadData = unreadData; }
@Override public boolean accept( final CommonIndexModel indexModel, final IndexedPersistenceEncoding<?> persistenceEncoding) { if ((persistenceEncoding == null) || ((persistenceEncoding.getInsertionPartitionKey() == null) && (persistenceEncoding.getInsertionSortKey() == null))) { return false; } return inBounds( persistenceEncoding.getInsertionPartitionKey(), persistenceEncoding.getInsertionSortKey()); }
public IndexedAdapterPersistenceEncoding getAdapterEncoding(final DataTypeAdapter dataAdapter) { final PersistentDataset<Object> adapterExtendedValues = new PersistentDataset<>(); if (persistenceEncoding instanceof AbstractAdapterPersistenceEncoding) { ((AbstractAdapterPersistenceEncoding) persistenceEncoding).convertUnknownValues( dataAdapter, model); final PersistentDataset<Object> existingExtValues = ((AbstractAdapterPersistenceEncoding) persistenceEncoding).getAdapterExtendedData(); if (existingExtValues != null) { adapterExtendedValues.addValues(existingExtValues.getValues()); } } adapterEncoding = new IndexedAdapterPersistenceEncoding( persistenceEncoding.getInternalAdapterId(), persistenceEncoding.getDataId(), persistenceEncoding.getInsertionPartitionKey(), persistenceEncoding.getInsertionSortKey(), persistenceEncoding.getDuplicateCount(), persistenceEncoding.getCommonData(), new PersistentDataset<byte[]>(), adapterExtendedValues); return adapterEncoding; }
@Override protected Envelope getEnvelope(final CommonIndexedPersistenceEncoding entry) { final CommonIndexValue v = entry.getCommonData().getValue(GeometryWrapper.DEFAULT_GEOMETRY_FIELD_NAME); if ((v != null) && (v instanceof GeometryWrapper)) { return ((GeometryWrapper) v).getGeometry().getEnvelopeInternal(); } return null; } }
@Override public boolean accept( final CommonIndexModel indexModel, final IndexedPersistenceEncoding<?> persistenceEncoding) { final ByteArray stringBytes = (ByteArray) persistenceEncoding.getCommonData().getValue(fieldName); if (stringBytes != null) { final String value = stringBytes.getString(); return caseSensitive ? matchValue.equals(value) : matchValue.equalsIgnoreCase(value); } return false; }
@Override public GeometryWrapper toIndexValue(final PersistentDataset<Object> adapterPersistenceEncoding) { final Geometry geometry = (Geometry) adapterPersistenceEncoding.getValue(nativeGeometryHandler.getFieldName()); // visibility is unnecessary because this only happens after the geometry is read (its only used // in reconstructing common index values when using a secondary index) return new GeometryWrapper(geometry, null); } }
@Override public boolean accept( final CommonIndexModel indexModel, final IndexedPersistenceEncoding persistenceEncoding) { return Objects.deepEquals( partitionKey, persistenceEncoding.getInsertionPartitionKey() != null ? persistenceEncoding.getInsertionPartitionKey() : new byte[] {}) && Objects.deepEquals( sortKey, persistenceEncoding.getInsertionSortKey() != null ? persistenceEncoding.getInsertionSortKey() : new byte[] {}) && Objects.deepEquals( dataId, persistenceEncoding.getDataId() != null ? persistenceEncoding.getDataId() : new byte[] {}); }
@Override public boolean accept( final CommonIndexModel indexModel, final IndexedPersistenceEncoding persistenceEncoding) { return (adapterId == null) || adapterId.equals((Short) persistenceEncoding.getInternalAdapterId()); }
@Override public boolean accept( final CommonIndexModel indexModel, final IndexedPersistenceEncoding persistenceEncoding) { return dataIds.contains(new ByteArray(persistenceEncoding.getDataId())); }
protected static CommonIndexedPersistenceEncoding getPersistenceEncoding( final GeoWaveKeyImpl rowKey, final PersistentDataset<CommonIndexValue> commonData, final FlattenedUnreadData unreadData) { return new DeferredReadCommonIndexedPersistenceEncoding( rowKey.getAdapterId(), rowKey.getDataId(), rowKey.getPartitionKey(), rowKey.getSortKey(), rowKey.getNumberOfDuplicates(), commonData, unreadData); }
@SuppressWarnings("unchecked") @Override public PersistentValue<Object>[] toNativeValues(final GeometryWrapper indexValue) { return new PersistentValue[] { new PersistentValue<>(nativeGeometryHandler.getFieldName(), indexValue.getGeometry())}; }
/** * Given an ordered set of dimensions, convert this persistent encoding common index data into a * MultiDimensionalNumericData object that can then be used by the Index * * @param dimensions * @return */ @SuppressWarnings({"rawtypes", "unchecked"}) public MultiDimensionalNumericData getNumericData(final NumericDimensionField[] dimensions) { final NumericData[] dataPerDimension = new NumericData[dimensions.length]; for (int d = 0; d < dimensions.length; d++) { final CommonIndexValue val = getCommonData().getValue(dimensions[d].getFieldName()); if (val != null) { dataPerDimension[d] = dimensions[d].getNumericData(val); } } return new BasicNumericDataset(dataPerDimension); }
public AsyncPersistenceEncoding( final short adapterId, final byte[] dataId, final byte[] partitionKey, final byte[] sortKey, final int duplicateCount, final BatchDataIndexRetrieval asyncRetrieval) { super( adapterId, dataId, partitionKey, sortKey, duplicateCount, new PersistentDataset<CommonIndexValue>(), new PersistentDataset<byte[]>(), new PersistentDataset<>()); this.asyncRetrieval = asyncRetrieval; }
@Override public boolean accept( final CommonIndexModel indexModel, final IndexedPersistenceEncoding<?> persistenceEncoding) { final ByteArray value = (ByteArray) persistenceEncoding.getCommonData().getValue(fieldName); if (value != null) { final double val = Lexicoders.DOUBLE.fromByteArray(value.getBytes()); if (inclusiveLow && inclusiveHigh) { return (val >= lowerValue.doubleValue()) && (val <= upperValue.doubleValue()); } else if (inclusiveLow) { return (val >= lowerValue.doubleValue()) && (val < upperValue.doubleValue()); } else if (inclusiveHigh) { return (val > lowerValue.doubleValue()) && (val <= upperValue.doubleValue()); } else { return (val > lowerValue.doubleValue()) && (val < upperValue.doubleValue()); } } return false; }
@Override public ImageChip decode(final IndexedAdapterPersistenceEncoding data, final Index index) { return ImageChipUtils.fromDataIdAndValue( data.getDataId(), (byte[]) data.getAdapterExtendedData().getValue(IMAGE_FIELD_NAME)); }
@Override public boolean accept( final CommonIndexModel indexModel, final IndexedPersistenceEncoding persistenceEncoding) { final byte[] otherPartitionKey = persistenceEncoding.getInsertionPartitionKey(); final byte[] otherPartitionKeyBytes = (otherPartitionKey != null) ? otherPartitionKey : new byte[0]; final byte[] sortKey = persistenceEncoding.getInsertionSortKey(); return (Arrays.equals(sortKeyPrefix, Arrays.copyOf(sortKey, sortKeyPrefix.length)) && Arrays.equals(partitionKey, otherPartitionKeyBytes)); }
public AdapterPersistenceEncoding( final short internalAdapterId, final byte[] dataId, final PersistentDataset<CommonIndexValue> commonData, final PersistentDataset<Object> adapterExtendedData) { super( internalAdapterId, dataId, null, null, 0, commonData, new PersistentDataset<byte[]>(), adapterExtendedData); // all data is identified by // the adapter, there is // inherently no unknown // data elements }
@Override public GridCoverage decode(final IndexedAdapterPersistenceEncoding data, final Index index) { final Object rasterTile = data.getAdapterExtendedData().getValue(DATA_FIELD_ID); if ((rasterTile == null) || !(rasterTile instanceof RasterTile)) { return null; } return getCoverageFromRasterTile( (RasterTile) rasterTile, data.getInsertionPartitionKey(), data.getInsertionSortKey(), index); }
/** filterKeyValue is executed second */ @Override public ReturnCode filterKeyValue(final Cell cell) throws IOException { if (wholeRowFilter) { // let filterRowCells do the work return ReturnCode.INCLUDE_AND_NEXT_COL; } commonData = new PersistentDataset<>(); unreadData = aggregateFieldData(cell, commonData); return applyFilter(cell); }