@API(value=EXPERIMENTAL) public class RewritePlanner extends Object implements QueryPlanner
QueryPlanner.IndexScanPreference
Constructor and Description |
---|
RewritePlanner(RecordMetaData metaData,
RecordStoreState recordStoreState) |
Modifier and Type | Method and Description |
---|---|
RecordQueryPlan |
plan(RecordQuery query)
Plan the given record query by attempting to match rules in a greedy fashion until no rules can be applied.
|
void |
setIndexScanPreference(QueryPlanner.IndexScanPreference indexScanPreference)
Set whether
RecordQueryIndexPlan is preferred over
RecordQueryScanPlan even when it does not satisfy any
additional conditions. |
public RewritePlanner(@Nonnull RecordMetaData metaData, @Nonnull RecordStoreState recordStoreState)
@Nonnull public RecordQueryPlan plan(@Nonnull RecordQuery query)
RecordQueryPlan
then the planning was successful and that plan is returned.
Otherwise, an exception is thrown.plan
in interface QueryPlanner
query
- a record query to planRecordCoreException
- if the planner could not plan the given querypublic void setIndexScanPreference(@Nonnull QueryPlanner.IndexScanPreference indexScanPreference)
QueryPlanner
RecordQueryIndexPlan
is preferred over
RecordQueryScanPlan
even when it does not satisfy any
additional conditions.
Scanning without an index is more efficient, but will have to skip over unrelated record types.
For that reason, it is safer to use an index, except when there is only one record type.
If the meta-data has more than one record type but the record store does not, this can be overridden.setIndexScanPreference
in interface QueryPlanner
indexScanPreference
- whether to prefer index scan over record scan