ddl

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package ddl holds the materialized-view index generator — the Go port of Java's MaterializedViewIndexGenerator (RFC-202). It is the single producer of index metadata from `CREATE INDEX … AS SELECT` (and, via the ON-source front end, `CREATE INDEX … ON t(cols)`) declarations: it consumes the logical plan the ordinary query front end built for the index's SELECT and emits the index's root key expression, type, and options.

Java reference (tag 4.12.11.0): fdb-relational-core/.../recordlayer/query/ddl/MaterializedViewIndexGenerator.java

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GeneratedIndex

type GeneratedIndex struct {
	// TableName is the record type the index is over — Java's
	// getRecordTypeName() (MaterializedViewIndexGenerator.java:791-801).
	TableName string
	// Root is the index's root key expression.
	Root recordlayer.KeyExpression
	// IndexType is a recordlayer.IndexType* constant ("" never happens; the
	// value arm emits VALUE or VERSION, the aggregate arm its own type).
	IndexType string
	// Options carries generator-owned options (PERMUTED_SIZE for permuted
	// min/max). May be nil.
	Options map[string]string
	// Predicate is the sparse-index predicate proto for a WHERE-carrying
	// definition (getTopLevelPredicate → IndexPredicate.fromQueryPredicate,
	// MaterializedViewIndexGenerator.java:169-172). Nil for a full index.
	Predicate *gen.Predicate
}

GeneratedIndex is the generator's output: everything the metadata builder needs to materialise the index. Mirrors the RecordLayerIndex.Builder state Java's generator fills in (name/table/type/unique are the caller's; the generator owns root expression, index type and options).

func Generate

Generate is the entry point: op is the logical plan of the index's SELECT as produced by the catalog-aware plan visitor (and its post-passes), md the metadata the SELECT was planned against.

Ports MaterializedViewIndexGenerator.generate (Java 4.14.2.0, MaterializedViewIndexGenerator.java:95-117): the query is translated into the graph Go's query path plans (Java plans the index query into its RelationalExpression graph, DdlVisitor.java:266), the graph's top is checked as DdlVisitor.java:274 checks it, IndexSpec is collected over it with the quantifiers resolved by QuantifierValues, checked for validity, and turned into the key expression, the index type and options, and the predicate.

type Options

type Options struct {
	// UseLegacyExtremumEver is Java's useLegacyBasedExtremumEver: `WITH
	// ATTRIBUTES LEGACY_EXTREMUM_EVER` selects the LONG-based extremum
	// maintainer (MIN_EVER_LONG / MAX_EVER_LONG) instead of the tuple-based
	// one (MaterializedViewIndexGenerator.java:449-465).
	UseLegacyExtremumEver bool
}

Options carries the caller-side switches Java threads into MaterializedViewIndexGenerator.from (DdlVisitor.java:214-216).

Jump to

Keyboard shortcuts

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