use of org.locationtech.geowave.core.store.adapter.AbstractAdapterPersistenceEncoding in project geowave by locationtech.
the class AggregationIterator method aggregateRow.
protected void aggregateRow(final Text currentRow, final CommonIndexModel model, final CommonIndexedPersistenceEncoding persistenceEncoding) {
if (adapter == null) {
aggregationFunction.aggregate(null, persistenceEncoding);
endRowOfAggregation = currentRow;
} else if (((Short) (persistenceEncoding.getInternalAdapterId())).equals((adapter.getAdapterId()))) {
final PersistentDataset<Object> adapterExtendedValues = new MultiFieldPersistentDataset<>();
if (persistenceEncoding instanceof AbstractAdapterPersistenceEncoding) {
((AbstractAdapterPersistenceEncoding) persistenceEncoding).convertUnknownValues(adapter, model);
final PersistentDataset<Object> existingExtValues = ((AbstractAdapterPersistenceEncoding) persistenceEncoding).getAdapterExtendedData();
if (existingExtValues != null) {
adapterExtendedValues.addValues(existingExtValues.getValues());
}
}
final IndexedAdapterPersistenceEncoding encoding = new IndexedAdapterPersistenceEncoding(persistenceEncoding.getInternalAdapterId(), persistenceEncoding.getDataId(), persistenceEncoding.getInsertionPartitionKey(), persistenceEncoding.getInsertionSortKey(), persistenceEncoding.getDuplicateCount(), persistenceEncoding.getCommonData(), new MultiFieldPersistentDataset<byte[]>(), adapterExtendedValues);
// the data adapter can't use the numeric index strategy and only
// the common index model to decode which is the case for feature
// data, we pass along a null strategy to eliminate the necessity to
// send a serialization of the strategy in the options of this
// iterator
final Object row = adapter.decode(encoding, indexMapping, new IndexImpl(null, model));
if (row != null) {
// for now ignore field info
aggregationFunction.aggregate(adapter, row);
endRowOfAggregation = currentRow;
}
}
}
use of org.locationtech.geowave.core.store.adapter.AbstractAdapterPersistenceEncoding in project geowave by locationtech.
the class ExpressionQueryFilter method accept.
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public boolean accept(final CommonIndexModel indexModel, final IndexedPersistenceEncoding<?> persistenceEncoding) {
if ((filter != null) && (indexModel != null) && (adapter != null) && (indexMapping != null)) {
final Map<String, Object> fieldValues = Maps.newHashMap();
if (!referencedFieldsInitialized) {
initReferencedFields();
}
final PersistentDataset<?> commonData = persistenceEncoding.getCommonData();
PersistentDataset<Object> adapterExtendedValues = null;
for (final String field : referencedFields) {
if (fieldValues.containsKey(field)) {
continue;
}
if (fieldToIndexFieldMap.containsKey(field)) {
final IndexFieldMapper<?, ?> mapper = fieldToIndexFieldMap.get(field);
final Object indexValue = commonData.getValue(mapper.indexFieldName());
((IndexFieldMapper) mapper).toAdapter(indexValue, new MapRowBuilder(fieldValues));
} else {
final Object value = commonData.getValue(field);
if (value != null) {
fieldValues.put(field, value);
} else {
if (adapterExtendedValues == null) {
adapterExtendedValues = new MultiFieldPersistentDataset<>();
if (persistenceEncoding instanceof AbstractAdapterPersistenceEncoding) {
((AbstractAdapterPersistenceEncoding) persistenceEncoding).convertUnknownValues(adapter, indexModel);
final PersistentDataset<Object> existingExtValues = ((AbstractAdapterPersistenceEncoding) persistenceEncoding).getAdapterExtendedData();
if (persistenceEncoding.isAsync()) {
return false;
}
if (existingExtValues != null) {
adapterExtendedValues.addValues(existingExtValues.getValues());
}
}
}
fieldValues.put(field, adapterExtendedValues.getValue(field));
}
}
}
return filter.evaluate(fieldValues);
}
return true;
}
use of org.locationtech.geowave.core.store.adapter.AbstractAdapterPersistenceEncoding in project geowave by locationtech.
the class HBaseDistributableFilter method getAdapterEncoding.
public IndexedAdapterPersistenceEncoding getAdapterEncoding(final InternalDataAdapter<?> dataAdapter) {
final PersistentDataset<Object> adapterExtendedValues = new MultiFieldPersistentDataset<>();
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 MultiFieldPersistentDataset<byte[]>(), adapterExtendedValues);
return adapterEncoding;
}
use of org.locationtech.geowave.core.store.adapter.AbstractAdapterPersistenceEncoding in project geowave by locationtech.
the class CQLQueryFilter method accept.
@Override
public boolean accept(final CommonIndexModel indexModel, final IndexedPersistenceEncoding persistenceEncoding) {
if ((filter != null) && (indexModel != null) && (adapter != null)) {
final PersistentDataset<Object> adapterExtendedValues = new MultiFieldPersistentDataset<>();
if (persistenceEncoding instanceof AbstractAdapterPersistenceEncoding) {
((AbstractAdapterPersistenceEncoding) persistenceEncoding).convertUnknownValues(adapter, indexModel);
final PersistentDataset<Object> existingExtValues = ((AbstractAdapterPersistenceEncoding) persistenceEncoding).getAdapterExtendedData();
if (persistenceEncoding.isAsync()) {
return false;
}
if (existingExtValues != null) {
adapterExtendedValues.addValues(existingExtValues.getValues());
}
}
final IndexedAdapterPersistenceEncoding encoding = new IndexedAdapterPersistenceEncoding(persistenceEncoding.getInternalAdapterId(), persistenceEncoding.getDataId(), persistenceEncoding.getInsertionPartitionKey(), persistenceEncoding.getInsertionSortKey(), persistenceEncoding.getDuplicateCount(), persistenceEncoding.getCommonData(), new MultiFieldPersistentDataset<byte[]>(), adapterExtendedValues);
final SimpleFeature feature = (SimpleFeature) adapter.decode(encoding, indexMapping, new IndexImpl(// because we
null, // options of this iterator
indexModel));
if (feature == null) {
return false;
}
return filter.evaluate(feature);
}
return true;
}
Aggregations