cockroach: Index | Files

package invertedidx

import ""


Package Files

geo.go inverted_index_expr.go

func GetGeoIndexRelationship Uses

func GetGeoIndexRelationship(expr opt.ScalarExpr) (_ geoindex.RelationshipType, ok bool)

GetGeoIndexRelationship returns the corresponding geospatial relationship and ok=true if the given expression is either a geospatial function or bounding box comparison operator that can be index-accelerated. Otherwise returns ok=false.

func NewDatumsToInvertedExpr Uses

func NewDatumsToInvertedExpr(
    evalCtx *tree.EvalContext, colTypes []*types.T, expr tree.TypedExpr, desc *descpb.IndexDescriptor,
) (invertedexpr.DatumsToInvertedExpr, error)

NewDatumsToInvertedExpr returns a new DatumsToInvertedExpr. Currently there is only one possible implementation returned, geoDatumsToInvertedExpr.

func NewGeoDatumsToInvertedExpr Uses

func NewGeoDatumsToInvertedExpr(
    evalCtx *tree.EvalContext, colTypes []*types.T, expr tree.TypedExpr, config *geoindex.Config,
) (invertedexpr.DatumsToInvertedExpr, error)

NewGeoDatumsToInvertedExpr returns a new geoDatumsToInvertedExpr.

func TryConstrainGeoIndex Uses

func TryConstrainGeoIndex(
    ctx context.Context,
    factory *norm.Factory,
    filters memo.FiltersExpr,
    tabID opt.TableID,
    index cat.Index,
) (
    invertedConstraint *invertedexpr.SpanExpression,
    preFiltererState *invertedexpr.PreFiltererStateForInvertedFilterer,
    ok bool,

TryConstrainGeoIndex tries to derive an inverted index constraint for the given geospatial index from the specified filters. If a constraint is derived, it is returned with ok=true. If no constraint can be derived, then TryConstrainGeoIndex returns ok=false.

func TryJoinGeoIndex Uses

func TryJoinGeoIndex(
    ctx context.Context,
    factory *norm.Factory,
    filters memo.FiltersExpr,
    tabID opt.TableID,
    index cat.Index,
    inputCols opt.ColSet,
) opt.ScalarExpr

TryJoinGeoIndex tries to create an inverted join with the given input and geospatial index from the specified filters. If a join is created, the inverted join condition is returned. If no join can be created, then TryJoinGeoIndex returns nil.

type PreFilterer Uses

type PreFilterer struct {
    // contains filtered or unexported fields

PreFilterer captures the pre-filtering state for a function whose non-indexed parameter (the lookup column for an inverted join) has not been bound to a value. The bound value is captured in the interface{} returned by Bind, to allow the caller to hold onto that state for a batch of lookup columns.

TODO(sumeer): - extend PreFilterer to more general expressions. - use PreFilterer for invertedFilterer (where it will be bound once).

func NewBoundPreFilterer Uses

func NewBoundPreFilterer(typ *types.T, expr tree.TypedExpr) (*PreFilterer, interface{}, error)

NewBoundPreFilterer returns a PreFilterer for the given expr where the type of the bound param is specified by typ. Unlike the use of PreFilterer in an inverted join, where each left value is bound, this function is for the invertedFilterer where the param to be bound is already specified as a constant in the expr. The callee will bind this parameter and return the opaque pre-filtering state for that binding (the interface{}) in the return values).

func NewPreFilterer Uses

func NewPreFilterer(
    typ *types.T, preFilterRelationship geoindex.RelationshipType, additionalParams []tree.Datum,
) *PreFilterer

NewPreFilterer constructs a PreFilterer

func (*PreFilterer) Bind Uses

func (p *PreFilterer) Bind(d tree.Datum) interface{}

Bind binds the datum and returns the pre-filter state.

func (*PreFilterer) PreFilter Uses

func (p *PreFilterer) PreFilter(
    enc invertedexpr.EncInvertedVal, preFilters []interface{}, result []bool,
) (bool, error)

PreFilter pre-filters a retrieved inverted value against a set of pre-filter states. The function signature matches the PreFilter function of the DatumsToInvertedExpr interface (PreFilterer does not implement the full interface): the result slice indicates which pre-filters matched and the single bool in the return value is true iff there is at least one result index with a true value.

Package invertedidx imports 22 packages (graph) and is imported by 3 packages. Updated 2020-09-27. Refresh now. Tools for package owners.