Search in sources :

Example 1 with OptimalExpressionQuery

use of org.locationtech.geowave.core.store.query.constraints.OptimalExpressionQuery in project geowave by locationtech.

the class ExpressionQueryIT method assertBestIndex.

private QueryConstraints assertBestIndex(final InternalDataAdapter<?> adapter, final Index bestIndex, final BaseQuery<?, ?> query, final PersistentAdapterStore adapterStore, final InternalAdapterStore internalAdapterStore, final AdapterIndexMappingStore aimStore, final IndexStore indexStore, final DataStatisticsStore statsStore) {
    assertTrue(query.getQueryConstraints() instanceof OptimalExpressionQuery);
    final OptimalExpressionQuery queryConstraints = (OptimalExpressionQuery) query.getQueryConstraints();
    @SuppressWarnings("rawtypes") List<Pair<Index, List<InternalDataAdapter<?>>>> optimalIndices = queryConstraints.determineBestIndices(query instanceof Query ? new BaseQueryOptions((Query) query, adapterStore, internalAdapterStore) : new BaseQueryOptions((AggregationQuery) query, adapterStore, internalAdapterStore), new InternalDataAdapter<?>[] { adapter }, aimStore, indexStore, statsStore);
    assertEquals(1, optimalIndices.size());
    final Pair<Index, List<InternalDataAdapter<?>>> indexAdapterPair = optimalIndices.get(0);
    assertEquals(bestIndex, indexAdapterPair.getKey());
    assertEquals(1, indexAdapterPair.getValue().size());
    assertEquals(adapter, indexAdapterPair.getValue().get(0));
    final QueryConstraints retVal = queryConstraints.createQueryConstraints(adapter, bestIndex, aimStore.getMapping(adapter.getAdapterId(), bestIndex.getName()));
    return retVal;
}
Also used : OptimalExpressionQuery(org.locationtech.geowave.core.store.query.constraints.OptimalExpressionQuery) BaseQuery(org.locationtech.geowave.core.store.query.BaseQuery) Query(org.locationtech.geowave.core.store.api.Query) AggregationQuery(org.locationtech.geowave.core.store.api.AggregationQuery) ExplicitFilteredQuery(org.locationtech.geowave.core.store.query.constraints.ExplicitFilteredQuery) FilteredEverythingQuery(org.locationtech.geowave.core.store.query.constraints.FilteredEverythingQuery) OptimalExpressionQuery(org.locationtech.geowave.core.store.query.constraints.OptimalExpressionQuery) InternalDataAdapter(org.locationtech.geowave.core.store.adapter.InternalDataAdapter) BaseQueryOptions(org.locationtech.geowave.core.store.base.BaseQueryOptions) Index(org.locationtech.geowave.core.store.api.Index) List(java.util.List) CustomQueryConstraints(org.locationtech.geowave.core.store.query.constraints.CustomQueryConstraints) QueryConstraints(org.locationtech.geowave.core.store.query.constraints.QueryConstraints) Pair(org.apache.commons.lang3.tuple.Pair)

Aggregations

List (java.util.List)1 Pair (org.apache.commons.lang3.tuple.Pair)1 InternalDataAdapter (org.locationtech.geowave.core.store.adapter.InternalDataAdapter)1 AggregationQuery (org.locationtech.geowave.core.store.api.AggregationQuery)1 Index (org.locationtech.geowave.core.store.api.Index)1 Query (org.locationtech.geowave.core.store.api.Query)1 BaseQueryOptions (org.locationtech.geowave.core.store.base.BaseQueryOptions)1 BaseQuery (org.locationtech.geowave.core.store.query.BaseQuery)1 CustomQueryConstraints (org.locationtech.geowave.core.store.query.constraints.CustomQueryConstraints)1 ExplicitFilteredQuery (org.locationtech.geowave.core.store.query.constraints.ExplicitFilteredQuery)1 FilteredEverythingQuery (org.locationtech.geowave.core.store.query.constraints.FilteredEverythingQuery)1 OptimalExpressionQuery (org.locationtech.geowave.core.store.query.constraints.OptimalExpressionQuery)1 QueryConstraints (org.locationtech.geowave.core.store.query.constraints.QueryConstraints)1