Class PvtPrefilterPlanner
Builds a cutting step that narrows the object set BEFORE the PVT aggregate runs.
The prefilter is a SUPERSET: it may let extra objects through, it may never lose one. The
authoritative filter stays where it is, above the aggregate. Anything the planner does not
understand yields a declined plan, which restores today's behaviour exactly.
Algebra (see docs/PVT_PREFILTER_PLAN.md section 3):
AND — an object satisfies every child, so any subset of children may be kept and the
rest dropped. We keep the single most selective one.
OR — an object needs only one child, so all children are required and none may be
dropped. One unrepresentable child kills the whole prefilter.
public static class PvtPrefilterPlanner
Inheritance
Methods
Build(FilterExpression?, IReadOnlyDictionary<string, FieldInfo>, IReadOnlyList<FieldInfo>, bool)
public static PvtPrefilterPlan Build(FilterExpression? filter, IReadOnlyDictionary<string, FieldInfo> fields, IReadOnlyList<FieldInfo> pvtFields, bool pivotUsedOutsideFilter)
BuildStreams(IReadOnlyList<FieldInfo>, IReadOnlyList<OrderingExpression>, bool, bool, FilterExpression?, bool)
Decides whether the streams form can replace the pivot CTE. Unlike this
public static PvtPrefilterPlan BuildStreams(IReadOnlyList<FieldInfo> pvtFields, IReadOnlyList<OrderingExpression> orderings, bool hasLimit, bool hasDistinct, FilterExpression? arrayLeavesIn = null, bool baseOrderingsInside = false)
DrivingLeaf(FilterExpression?, IReadOnlyDictionary<string, FieldInfo>)
The leaf of the top-level AND that a set of objects can be read from instead of the objects of the scheme:
public static PvtPrefilterBranch? DrivingLeaf(FilterExpression? filter, IReadOnlyDictionary<string, FieldInfo> fields)
HasNarrowBaseConjunct(FilterExpression?)
Whether the top-level AND of the filter holds a base-field leaf that is narrow by its shape: an
public static bool HasNarrowBaseConjunct(FilterExpression? filter)
HasNarrowConjunct(FilterExpression?, IReadOnlyDictionary<string, FieldInfo>)
Whether the top-level AND of the filter holds a leaf that is narrow by its shape (score of at
public static bool HasNarrowConjunct(FilterExpression? filter, IReadOnlyDictionary<string, FieldInfo> fields)
HasNarrowDisjunction(FilterExpression?, IReadOnlyDictionary<string, FieldInfo>)
Whether the filter, or an operand of its top-level AND, is an OR whose every branch is narrow
public static bool HasNarrowDisjunction(FilterExpression? filter, IReadOnlyDictionary<string, FieldInfo> fields)
IsDictionaryEntry(FieldInfo)
One entry of a dictionary addressed by its key, PhoneDirectory["desk"]: the resolver hands the dictionary's own
public static bool IsDictionaryEntry(FieldInfo field)
LeafOn(FilterExpression?, IReadOnlyDictionary<string, FieldInfo>, FieldInfo)
The conditions of the top-level AND on field, merged into one branch, or null.
public static PvtPrefilterBranch? LeafOn(FilterExpression? filter, IReadOnlyDictionary<string, FieldInfo> fields, FieldInfo field)
OpenRangeLeaf(FilterExpression?, IReadOnlyDictionary<string, FieldInfo>)
An open range in the top-level AND (only >, >=, <, <= on one field), or null: a condition
public static PvtPrefilterBranch? OpenRangeLeaf(FilterExpression? filter, IReadOnlyDictionary<string, FieldInfo> fields)
RejectsNull(FilterExpression?, IReadOnlyDictionary<string, FieldInfo>, FieldInfo)
Whether the top-level AND holds a comparison on field that no NULL passes:
public static bool RejectsNull(FilterExpression? filter, IReadOnlyDictionary<string, FieldInfo> fields, FieldInfo field)
ScalarLeaf(FilterExpression, IReadOnlyDictionary<string, FieldInfo>)
One filter node as a predicate on one _values row of a scalar Props field, or null when it is not one.
public static PvtPrefilterBranch? ScalarLeaf(FilterExpression node, IReadOnlyDictionary<string, FieldInfo> fields)