Documentation
¶
Overview ¶
Package plan implements the Ivfflat plugin's plan-layer hooks. Phase 6 split: bodies live in pkg/sql/plan; this file is thin redirects. See pkg/vectorindex/hnsw/plugin/plan/plan.go for the canonical template.
Index ¶
- Constants
- Variables
- type Hooks
- func (Hooks) ApplyForSort(pb planplugin.PlanBuilder, vctx *planplugin.VectorSortContext, ...) (int32, bool, error)
- func (Hooks) BuildFullTextIndexDefs(_ planplugin.CompilerContext, _ *tree.FullTextIndex, _ map[string]*plan.ColDef, ...) ([]*plan.IndexDef, []*plan.TableDef, error)
- func (Hooks) BuildSecondaryIndexDefs(ctx planplugin.CompilerContext, indexInfo *tree.Index, ...) ([]*plan.IndexDef, []*plan.TableDef, error)
- func (Hooks) CanApply(pb planplugin.PlanBuilder, vctx *planplugin.VectorSortContext, ...) (bool, error)
Constants ¶
const ( IVFFLATCreateFuncName = "ivf_create" IVFFLATSearchFuncName = "ivf_search" )
Variables ¶
var ( // IVFFLATSearchColDefs is the (pkid, score) schema the ivf_search // table function returns. Exported so the ApplyForSort body in // plan.go can reference it. pkid type gets rewritten at plan time // to the parent table's actual PK type. IVFFLATSearchColDefs = []*plan.ColDef{ { Name: "pkid", Typ: plan.Type{ Id: int32(types.T_any), NotNullable: false, }, }, { Name: "score", Typ: plan.Type{ Id: int32(types.T_float64), NotNullable: false, Width: 8, }, }, } )
Functions ¶
This section is empty.
Types ¶
type Hooks ¶
type Hooks struct{}
func (Hooks) ApplyForSort ¶
func (Hooks) ApplyForSort(pb planplugin.PlanBuilder, vctx *planplugin.VectorSortContext, mti *planplugin.MultiTableIndexRef, nodeID int32, opts planplugin.ApplyForSortOpts) (int32, bool, error)
func (Hooks) BuildFullTextIndexDefs ¶
func (Hooks) BuildFullTextIndexDefs( _ planplugin.CompilerContext, _ *tree.FullTextIndex, _ map[string]*plan.ColDef, _ []*plan.IndexDef, _ string, ) ([]*plan.IndexDef, []*plan.TableDef, error)
BuildFullTextIndexDefs is unreachable for ivfflat — the plan-build dispatch only routes *tree.FullTextIndex parse trees to the fulltext plugin. Returning an error here makes any misrouting visible.
func (Hooks) BuildSecondaryIndexDefs ¶
func (Hooks) BuildSecondaryIndexDefs( ctx planplugin.CompilerContext, indexInfo *tree.Index, colMap map[string]*plan.ColDef, existedIndexes []*plan.IndexDef, pkeyName string, ) ([]*plan.IndexDef, []*plan.TableDef, error)
BuildSecondaryIndexDefs builds the three hidden tables IVF-FLAT needs: metadata (key/val for version + clustering timestamps), centroids (version + id + centroid + composite PK), entries (version + id + origin_pk + entry + composite PK).
Lifted verbatim from pkg/sql/plan/build_ddl.go:2480 (buildIvfFlatSecondaryIndexDef, now deleted).
func (Hooks) CanApply ¶
func (Hooks) CanApply(pb planplugin.PlanBuilder, vctx *planplugin.VectorSortContext, mti *planplugin.MultiTableIndexRef) (bool, error)