use of org.locationtech.geowave.core.index.simple.SimpleNumericIndexStrategy in project geowave by locationtech.
the class TemporalBetween method getConstraints.
@SuppressWarnings("unchecked")
@Override
public <V extends Comparable<V>> FilterConstraints<V> getConstraints(final Class<V> constraintClass, final DataStatisticsStore statsStore, final DataTypeAdapter<?> adapter, final AdapterToIndexMapping indexMapping, final Index index, final Set<String> indexedFields) {
if ((valueExpr instanceof FieldValue) && indexedFields.contains(((FieldValue<?>) valueExpr).getFieldName()) && lowerBoundExpr.isLiteral() && upperBoundExpr.isLiteral() && constraintClass.isAssignableFrom(Double.class)) {
final Interval lowerBound = lowerBoundExpr.evaluateValue(null, null);
final Interval upperBound = upperBoundExpr.evaluateValue(null, null);
if ((lowerBound != null) && (upperBound != null)) {
return FilterConstraints.of(adapter, indexMapping, index, ((FieldValue<?>) valueExpr).getFieldName(), (IndexFieldConstraints<V>) NumericFieldConstraints.of((double) lowerBound.getStart().toEpochMilli(), (double) TimeUtils.getIntervalEnd(upperBound).toEpochMilli(), true, false, index.getIndexStrategy() instanceof SimpleNumericIndexStrategy));
}
}
return FilterConstraints.empty();
}
use of org.locationtech.geowave.core.index.simple.SimpleNumericIndexStrategy in project geowave by locationtech.
the class BinaryTemporalPredicate method getConstraints.
@SuppressWarnings("unchecked")
@Override
public <V extends Comparable<V>> FilterConstraints<V> getConstraints(final Class<V> constraintClass, final DataStatisticsStore statsStore, final DataTypeAdapter<?> adapter, final AdapterToIndexMapping indexMapping, final Index index, final Set<String> indexedFields) {
if ((expression1 instanceof FieldValue) && indexedFields.contains(((FieldValue<?>) expression1).getFieldName()) && expression2.isLiteral() && constraintClass.isAssignableFrom(Double.class)) {
final Double minValue;
final Double maxValue;
if (index.getIndexStrategy() instanceof SimpleNumericIndexStrategy) {
minValue = null;
maxValue = null;
} else {
final TimeRangeValue timeRange = InternalStatisticsHelper.getFieldStatistic(statsStore, TimeRangeStatistic.STATS_TYPE, adapter.getTypeName(), ((FieldValue<?>) expression1).getFieldName());
if (timeRange != null) {
minValue = (double) timeRange.getMin();
maxValue = (double) timeRange.getMax();
} else {
// We cannot determine the query range for the binned
return FilterConstraints.empty();
}
}
String fieldName = ((FieldValue<?>) expression1).getFieldName();
final boolean partOfRange = isPartOfRange(fieldName, indexMapping);
final Interval literal = expression2.evaluateValue(null, null);
if (literal != null) {
return FilterConstraints.of(adapter, indexMapping, index, fieldName, (IndexFieldConstraints<V>) getConstraints(literal, minValue, maxValue, false, !partOfRange && index.getIndexStrategy() instanceof SimpleNumericIndexStrategy));
}
} else if ((expression2 instanceof FieldValue) && indexedFields.contains(((FieldValue<?>) expression2).getFieldName()) && expression1.isLiteral() && constraintClass.isAssignableFrom(Double.class)) {
final Double minValue;
final Double maxValue;
if (index.getIndexStrategy() instanceof SimpleNumericIndexStrategy) {
minValue = null;
maxValue = null;
} else {
final TimeRangeValue timeRange = InternalStatisticsHelper.getFieldStatistic(statsStore, TimeRangeStatistic.STATS_TYPE, adapter.getTypeName(), ((FieldValue<?>) expression2).getFieldName());
if (timeRange != null) {
minValue = (double) timeRange.getMin();
maxValue = (double) timeRange.getMax();
} else {
// We cannot determine the query range for the binned
return FilterConstraints.empty();
}
}
String fieldName = ((FieldValue<?>) expression2).getFieldName();
final boolean partOfRange = isPartOfRange(fieldName, indexMapping);
final Interval literal = expression1.evaluateValue(null, null);
if (literal != null) {
return FilterConstraints.of(adapter, indexMapping, index, fieldName, (IndexFieldConstraints<V>) getConstraints(literal, minValue, maxValue, true, !partOfRange && index.getIndexStrategy() instanceof SimpleNumericIndexStrategy));
}
}
return FilterConstraints.empty();
}
Aggregations