|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.amazon.carbonado.qe.FilteringScore<S>
public class FilteringScore<S extends Storable>
Evaluates an index for how well it matches a query's desired filtering. A filtering score is not a single absolute value – instead it has a relative weight when compared to other scores.
An index matches a desired filtering if the arrangement of properties and
its relational operator matches. A matching = operator is
an identity match. A range match is determined by a matching operator of
>, >=, <, or <=. Filters with a != operator are
ignored. Although not all index properties need to be used, the first must
be and no gaps are allowed.
A FilteringScore measures the number of filter properties that are matched and the number that are remaining. If there are remainder properties, then the user of the evaluated index will need to perform an additional filtering operation to achieve the desired results.
In general, a FilteringScore is better than another if it has more matched properties and fewer remainder properties. Matching more identity properties is given preference over matching range properties. Index clustering is also considered for score comparison.
OrderingScore,
CompositeScore| Method Summary | ||
|---|---|---|
boolean |
canMergeRemainderFilter(FilteringScore<S> other)
Returns true if the given score uses an index exactly the same as this one. |
|
static
|
evaluate(OrderedProperty<S>[] indexProperties,
boolean unique,
boolean clustered,
Filter<S> filter)
Evaluates the given index properties for its filtering capabilities against the given filter. |
|
static
|
evaluate(StorableIndex<S> index,
Filter<S> filter)
Evaluates the given index for its filtering capabilities against the given filter. |
|
static Comparator<FilteringScore<?>> |
fullComparator()
Returns a comparator which determines which FilteringScores are better. |
|
int |
getArrangementScore()
Returns a value which indicates how well the index property order matches the property filter specification order. |
|
int |
getCoveringCount()
Returns number of covering property filters which are supported by the evaluated index. |
|
Filter<S> |
getCoveringFilter()
Returns the composite covering filter supported by the evaluated index, or null if the covering count is zero. |
|
List<? extends Filter<S>> |
getCoveringFilters()
Returns the covering filters which are supported by the evaluated index, which is a subset of the remainder filters. |
|
Filter<S> |
getCoveringRemainderFilter()
Returns the composite remainder filter without including the covering filter. |
|
List<PropertyFilter<S>> |
getExclusiveRangeEndFilters()
Returns the range end property filters supported by the evaluated index whose operator is only RelOp.LT. |
|
List<PropertyFilter<S>> |
getExclusiveRangeStartFilters()
Returns the range start property filters supported by the evaluated index whose operator is only RelOp.GT. |
|
int |
getHandledCount()
Returns the count of all handled property filters. |
|
Filter<S> |
getHandledFilter()
Returns the composite handled filter, or null if no matches at all. |
|
int |
getIdentityCount()
Returns number of consecutive left-aligned index properties which match property filters with an operator of RelOp.EQ. |
|
Filter<S> |
getIdentityFilter()
Returns the composite identity filter, or null if no identity property filters. |
|
List<PropertyFilter<S>> |
getIdentityFilters()
Returns the identity property filters supported by the evaluated index. |
|
List<PropertyFilter<S>> |
getInclusiveRangeEndFilters()
Returns the range end property filters supported by the evaluated index whose operator is only RelOp.LE. |
|
List<PropertyFilter<S>> |
getInclusiveRangeStartFilters()
Returns the range start property filters supported by the evaluated index whose operator is only RelOp.GE. |
|
int |
getIndexPropertyCount()
Returns the amount of properties in the evaluated index. |
|
Comparable |
getPreferenceScore()
Returns a value which indicates user index preference, based on the original ordering of elements in the filter. |
|
List<PropertyFilter<S>> |
getRangeEndFilters()
Returns the range end property filters supported by the evaluated index. |
|
List<PropertyFilter<S>> |
getRangeStartFilters()
Returns the range start property filters supported by the evaluated index. |
|
int |
getRemainderCount()
Returns number of property filters not supported by the evaluated index. |
|
Filter<S> |
getRemainderFilter()
Returns the composite remainder filter not supported by the evaluated index, or null if no remainder. |
|
List<? extends Filter<S>> |
getRemainderFilters()
Returns the filters not supported by the evaluated index. |
|
boolean |
hasAnyMatches()
Returns true if the identity count is greater than zero or if there is a range match. |
|
boolean |
hasRangeEnd()
Returns true if any property filter with an operator of RelOp.LT
or RelOp.LE matches an index property. |
|
boolean |
hasRangeMatch()
Returns true if there is both a range start and range end. |
|
boolean |
hasRangeStart()
Returns true if any property filter with an operator of RelOp.GT
or RelOp.GE matches an index property. |
|
boolean |
isIndexClustered()
Returns true if evaluated index is clustered. |
|
boolean |
isIndexUnique()
Returns true if evaluated index is unique. |
|
boolean |
isKeyMatch()
Returns true if evaluated index is unique and each of its properties has an identity match. |
|
Filter<S> |
mergeRemainderFilter(FilteringScore<S> other)
Merges the remainder filter of this score with the one given using an 'or' operation. |
|
static Comparator<FilteringScore<?>> |
rangeComparator()
Returns a partial comparator which determines which FilteringScores are better by examining only identity and range matches. |
|
boolean |
shouldReverseRange()
Returns true if there is a range start or end match, but natural order of matching property is descending. |
|
String |
toString()
|
|
FilteringScore<S> |
withRemainderFilter(Filter<S> filter)
Returns a new FilteringScore with the remainder replaced and covering matches recalculated. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static <S extends Storable> FilteringScore<S> evaluate(StorableIndex<S> index,
Filter<S> filter)
index - index to evaluatefilter - filter which cannot contain any logical 'or' operations.
IllegalArgumentException - if index is null or filter is not supported
public static <S extends Storable> FilteringScore<S> evaluate(OrderedProperty<S>[] indexProperties,
boolean unique,
boolean clustered,
Filter<S> filter)
indexProperties - index properties to evaluateunique - true if index is uniqueclustered - true if index is clusteredfilter - filter which cannot contain any logical 'or' operations.
IllegalArgumentException - if index is null or filter is not supportedpublic static Comparator<FilteringScore<?>> rangeComparator()
<0 if first score is better,
0 if equal, or >0 if second is better.
public static Comparator<FilteringScore<?>> fullComparator()
<0 if first score is better, 0 if equal, or
>0 if second is better.
public boolean isIndexClustered()
public boolean isIndexUnique()
public int getIndexPropertyCount()
public int getIdentityCount()
RelOp.EQ.
public List<PropertyFilter<S>> getIdentityFilters()
RelOp.EQ.
public Filter<S> getIdentityFilter()
public boolean hasRangeStart()
RelOp.GT
or RelOp.GE matches an index property. The index property used
for the range is the first one following the identity count.
public List<PropertyFilter<S>> getRangeStartFilters()
RelOp.GT or RelOp.GE. The property of each filter is identical, and the properties
are also identical to any range end filters.
public List<PropertyFilter<S>> getExclusiveRangeStartFilters()
RelOp.GT. This list is a subset of
those returned by getRangeStartFilters().
public List<PropertyFilter<S>> getInclusiveRangeStartFilters()
RelOp.GE. This list is a subset of
those returned by getRangeStartFilters().
public boolean hasRangeEnd()
RelOp.LT
or RelOp.LE matches an index property. The index property used
for the range is the first one following the identity count.
public List<PropertyFilter<S>> getRangeEndFilters()
RelOp.LT or RelOp.LE. The property of each filter is identical, and the properties
are also identical to any range start filters.
public List<PropertyFilter<S>> getExclusiveRangeEndFilters()
RelOp.LT. This list is a subset of
those returned by getRangeEndFilters().
public List<PropertyFilter<S>> getInclusiveRangeEndFilters()
RelOp.LE. This list is a subset of
those returned by getRangeEndFilters().
public int getHandledCount()
public Filter<S> getHandledFilter()
public boolean hasRangeMatch()
public boolean hasAnyMatches()
public int getArrangementScore()
public Comparable getPreferenceScore()
public int getRemainderCount()
public List<? extends Filter<S>> getRemainderFilters()
public Filter<S> getRemainderFilter()
public int getCoveringCount()
public List<? extends Filter<S>> getCoveringFilters()
public Filter<S> getCoveringFilter()
public Filter<S> getCoveringRemainderFilter()
public boolean isKeyMatch()
public boolean shouldReverseRange()
public boolean canMergeRemainderFilter(FilteringScore<S> other)
public Filter<S> mergeRemainderFilter(FilteringScore<S> other)
public FilteringScore<S> withRemainderFilter(Filter<S> filter)
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||