plan

package
v0.0.0-debug-20260702 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package plan implements the Ivfpq 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

View Source
const (
	IVFPQCreateFuncName = "ivfpq_create"
	IVFPQSearchFuncName = "ivfpq_search"
)

Variables

View Source
var (

	// IVFPQSearchColDefs is the (pkid, score) schema the ivfpq_search
	// table function returns. Exported so the ApplyForSort body in
	// plan.go can reference it.
	IVFPQSearchColDefs = []*plan.ColDef{
		{
			Name: "pkid",
			Typ: plan.Type{
				Id:          int32(types.T_int64),
				NotNullable: false,
				Width:       8,
			},
		},
		{
			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) BuildFullTextIndexDefs

func (Hooks) BuildFullTextIndexDefs(
	_ planplugin.CompilerContext,
	_ *tree.FullTextIndex,
	_ map[string]*plan.ColDef,
	_ []*plan.IndexDef,
	_ string,
) ([]*plan.IndexDef, []*plan.TableDef, error)

BuildFullTextIndexDefs is unreachable for ivfpq — 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 runs during plan-tree construction for CREATE INDEX (pkg/sql/plan/build_ddl.go:2081 dispatch). It returns the per-hidden-table IndexDef and TableDef pair that pkg/sql/compile will later create on disk.

The IndexDef list and TableDef list must align positionally — one entry per hidden table. For IVF-PQ that is two: a small metadata table (mo_secondary_metadata_xxx — index_id, checksum, timestamp, filesize), and a chunked storage table (mo_secondary_index_xxx — the serialized index payload split into blob chunks). The TableType field is what CatalogHooks.HiddenTableTypes() returned earlier; the framework keys downstream maps by this.

Helpers available from planplugin (populated by pkg/sql/plan's init):

planplugin.CreateIndexDef         — constructs the *plan.IndexDef
                                    (serializes algo params from
                                    indexInfo.IndexOption into JSON)
planplugin.MakeHiddenColDefByName — builds a hidden composite-PK
                                    placeholder column (used for the
                                    storage table's compound PK)
planplugin.ValidateIncludeColumns — validates INCLUDE column list
                                    against colMap + pk constraints

Lifted from pkg/sql/plan/build_ddl.go:3114-3353 (the deleted buildIvfpqSecondaryIndexDef).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL