plans

package
v0.0.0-...-741f41f Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Go extension — no Java equivalent.

Java's Cascades has no physical sort operator; RemoveSortRule eliminates the sort via index ordering or fails the query. This plan materializes the inner result and sorts in memory.

Package plans is the physical-plan ("RecordQueryPlan") hierarchy the Cascades planner emits after Batch A rules implement logical expressions as concrete query operators.

Mirrors Java's `com.apple.foundationdb.record.query.plan.plans` package. Java has 74 RecordQueryPlan classes; the seed ports the minimum set Batch A's first rules need:

  • RecordQueryScanPlan — primary-key scan over a record type.
  • RecordQueryFilterPlan — applies a QueryPredicate to an inner plan's row stream.
  • RecordQuerySortPlan — sorts an inner plan's row stream.

The seed deliberately omits Java's full surface (Execute method, PlanHashable, continuation handling, complex covering-index machinery) — those land as the rule chain that produces these plans starts consuming them. The seed is the type structure + node-info equality so PrimaryScanRule / ImplementFilterRule / ImplementSortRule (all B5 Batch A) have a target to yield into.

Why a separate sub-package vs cascades/expressions/: physical and logical plan trees live in different namespaces in Java. A RelationalExpression is logical (rule input); a RecordQueryPlan is physical (rule output, executor input). Mixing them risks pattern-match confusion in rules. Separation also matches Java's package layout — code review across languages stays tractable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equals

func Equals(a, b RecordQueryPlan) bool

Equals walks two plan trees and reports semantic equality — node-info match plus pairwise child equality. The plans seed doesn't have alias-aware comparison (no Quantifiers in the physical layer); positional pairing only.

Returns true if both nil.

func PlanHash

func PlanHash(p RecordQueryPlan) uint64

PlanHash computes a deterministic hash of the entire plan tree. The hash combines each node's HashCodeWithoutChildren with its structural position (depth-first traversal order). Two plans with the same tree shape and same node-info hash to the same key.

Consumed by plan logging (PlanGenerationInfo.PlanHash — the plan's identity in observability output). In-memory only: the plan cache is keyed by normalized SQL text, and no continuation or wire artifact embeds this hash, so its value may change across releases (RFC-176 P2 did) without compatibility impact.

func PlanHashEqual

func PlanHashEqual(a, b RecordQueryPlan) bool

PlanHashEqual reports whether two plans have the same hash.

func Size

func Size(p RecordQueryPlan) int

Size returns the total node count of the plan tree rooted at `p`, including `p` itself. Returns 0 for nil.

func UnableToTranslate

func UnableToTranslate(_ values.Value, _, _ values.CorrelationIdentifier) (values.Value, bool)

UnableToTranslate is a TranslateValueFunction that always fails (returns false). Used when no translation is possible.

func Walk

func Walk(p RecordQueryPlan, visit func(RecordQueryPlan) bool)

Walk invokes `visit` on `p` and (if visit returns true) recursively on every reachable RecordQueryPlan via GetChildren. Returning false from `visit` short-circuits the walk for that subtree (siblings + ancestors continue).

Counterpart to expressions.Walk for the logical side.

Types

type Copier

type Copier interface {
	Copy(output map[string]any, key, value tuple.Tuple) bool
}

Copier extracts a field from an index entry and sets it in the output map.

type DfsTraversalStrategy

type DfsTraversalStrategy int

DfsTraversalStrategy selects pre-order vs post-order traversal for the recursive DFS join.

const (
	DfsPreorder DfsTraversalStrategy = iota
	DfsPostorder
)

func (DfsTraversalStrategy) String

func (s DfsTraversalStrategy) String() string

type FetchIndexRecords

type FetchIndexRecords int

FetchIndexRecords governs how to interpret the primary key of an index entry when fetching the base record. Mirrors Java's `RecordQueryFetchFromPartialRecordPlan.FetchIndexRecords` enum.

const (
	// FetchIndexRecordsPrimaryKey fetches the base record by its
	// primary key (the standard path).
	FetchIndexRecordsPrimaryKey FetchIndexRecords = iota
	// FetchIndexRecordsSyntheticConstituents fetches synthetic record
	// constituents (for synthetic/joined record types).
	FetchIndexRecordsSyntheticConstituents
)

type FieldCopier

type FieldCopier struct {
	Field       string
	Source      TupleSource
	OrdinalPath []int
}

FieldCopier copies a single field from an index key or value tuple.

func (*FieldCopier) Copy

func (c *FieldCopier) Copy(output map[string]any, key, value tuple.Tuple) bool

type InSourceKind

type InSourceKind int

InSourceKind distinguishes the three Java InJoin subclasses.

const (
	InSourceValues    InSourceKind = iota // static value list (InValuesJoinPlan)
	InSourceParameter                     // runtime parameter binding (InParameterJoinPlan)
	InSourceComparand                     // comparand from correlated subquery (InComparandJoinPlan)
)

type IndexKeyValueToPartialRecord

type IndexKeyValueToPartialRecord struct {
	// contains filtered or unexported fields
}

IndexKeyValueToPartialRecord reconstructs a partial record from an index entry's key and value tuples. Used by covering index plans to avoid fetching the full record from FDB.

Ports Java's IndexKeyValueToPartialRecord. The Go version produces map[string]any (the SQL layer's row format) instead of proto Messages.

func (*IndexKeyValueToPartialRecord) ToRecord

func (r *IndexKeyValueToPartialRecord) ToRecord(key, value tuple.Tuple) map[string]any

ToRecord reconstructs a partial record map from an index entry.

type IndexKeyValueToPartialRecordBuilder

type IndexKeyValueToPartialRecordBuilder struct {
	// contains filtered or unexported fields
}

IndexKeyValueToPartialRecordBuilder builds an IndexKeyValueToPartialRecord.

func NewIndexKeyValueToPartialRecordBuilder

func NewIndexKeyValueToPartialRecordBuilder() *IndexKeyValueToPartialRecordBuilder

NewIndexKeyValueToPartialRecordBuilder creates a new builder.

func (*IndexKeyValueToPartialRecordBuilder) AddField

AddField adds a field copier.

func (*IndexKeyValueToPartialRecordBuilder) Build

Build constructs the IndexKeyValueToPartialRecord.

func (*IndexKeyValueToPartialRecordBuilder) SetRequired

SetRequired marks the record as required (ToRecord panics on nil).

type JoinType

type JoinType int

JoinType distinguishes inner vs outer vs cross joins.

const (
	JoinInner JoinType = iota
	JoinLeftOuter
	JoinCross

	// JoinFullOuter — FULL OUTER JOIN: every left row (matched or
	// NULL-padded right) plus every right row that matched no left row
	// (NULL-padded left). Go-only query extension; Java's SQL layer has
	// no outer joins. Appended (not inserted) to keep prior iota values
	// stable. Implemented only by the materialized nested-loop cursor,
	// never the correlated FlatMap path (which cannot observe global
	// inner-match state).
	JoinFullOuter
)

func (JoinType) String

func (jt JoinType) String() string

type KeysSource

type KeysSource interface {
	// GetPrimaryKeys returns the list of primary keys to load.
	GetPrimaryKeys() []tuple.Tuple
	// MaxCardinality returns the maximum number of records this
	// source can produce, or -1 if unknown.
	MaxCardinality() int
	// Equals reports equality with another KeysSource.
	Equals(other KeysSource) bool
	// String returns a human-readable label.
	String() string
}

KeysSource provides primary keys for RecordQueryLoadByKeysPlan. Mirrors Java's RecordQueryLoadByKeysPlan.KeysSource interface.

type ParameterKeySource

type ParameterKeySource struct {
	// contains filtered or unexported fields
}

ParameterKeySource gets primary keys from a named parameter. Mirrors Java's ParameterKeySource inner class.

func NewParameterKeySource

func NewParameterKeySource(parameter string) *ParameterKeySource

NewParameterKeySource constructs a parameter-bound key source.

func (*ParameterKeySource) Equals

func (s *ParameterKeySource) Equals(other KeysSource) bool

Equals compares parameter names.

func (*ParameterKeySource) GetParameter

func (s *ParameterKeySource) GetParameter() string

GetParameter returns the parameter name.

func (*ParameterKeySource) GetPrimaryKeys

func (s *ParameterKeySource) GetPrimaryKeys() []tuple.Tuple

GetPrimaryKeys always returns nil — the actual keys come from the evaluation context at execution time.

func (*ParameterKeySource) MaxCardinality

func (s *ParameterKeySource) MaxCardinality() int

MaxCardinality returns -1 (unknown).

func (*ParameterKeySource) String

func (s *ParameterKeySource) String() string

String renders the parameter reference.

type PlanSelector

type PlanSelector interface {
	// SelectPlan picks the index of the plan to execute.
	SelectPlan(plans []RecordQueryPlan) int
	// Equals reports equality with another PlanSelector.
	Equals(other PlanSelector) bool
	// String returns a human-readable label.
	String() string
}

PlanSelector selects one child plan index from a list at runtime. Mirrors Java's PlanSelector interface.

type PrimaryKeysKeySource

type PrimaryKeysKeySource struct {
	// contains filtered or unexported fields
}

PrimaryKeysKeySource is a concrete list of primary keys. Mirrors Java's PrimaryKeysKeySource inner class.

func NewPrimaryKeysKeySource

func NewPrimaryKeysKeySource(primaryKeys []tuple.Tuple) *PrimaryKeysKeySource

NewPrimaryKeysKeySource constructs a key source from a list of primary key tuples.

func (*PrimaryKeysKeySource) Equals

func (s *PrimaryKeysKeySource) Equals(other KeysSource) bool

Equals compares key lists.

func (*PrimaryKeysKeySource) GetPrimaryKeys

func (s *PrimaryKeysKeySource) GetPrimaryKeys() []tuple.Tuple

GetPrimaryKeys returns the key list.

func (*PrimaryKeysKeySource) MaxCardinality

func (s *PrimaryKeysKeySource) MaxCardinality() int

MaxCardinality returns the list length.

func (*PrimaryKeysKeySource) String

func (s *PrimaryKeysKeySource) String() string

String renders the key list.

type RecordQueryAggregateIndexPlan

type RecordQueryAggregateIndexPlan struct {
	// contains filtered or unexported fields
}

RecordQueryAggregateIndexPlan wraps an index scan that reads from an aggregate index (e.g. SUM, COUNT) and reconstructs records from the index entries. This is a leaf plan (no children — the wrapped RecordQueryIndexPlan is a structural field, not a child in the plan tree sense). Mirrors Java's RecordQueryAggregateIndexPlan.

Fields:

  • indexPlan: the underlying index scan plan.
  • recordTypeName: the base record type name (for metadata lookup).
  • resultType: the rich Type of the aggregated result row.
  • aggregateFunction: the name of the aggregate function (e.g. "SUM", "COUNT", "MIN", "MAX").

func NewRecordQueryAggregateIndexPlan

func NewRecordQueryAggregateIndexPlan(
	indexPlan *RecordQueryIndexPlan,
	recordTypeName string,
	resultType values.Type,
	aggregateFunction string,
) *RecordQueryAggregateIndexPlan

NewRecordQueryAggregateIndexPlan constructs an aggregate index plan.

func (*RecordQueryAggregateIndexPlan) CanonicalAggColumnName

func (p *RecordQueryAggregateIndexPlan) CanonicalAggColumnName() string

CanonicalAggColumnName returns the canonical column name the executor's aggregateIndexCursor writes the aggregate value under: "FUNC(*)" for an empty aggColumn (e.g. COUNT(*)), else "FUNC(col)". Single source of that name so the cursor and planColumnNamesWithMD stay byte-identical.

func (*RecordQueryAggregateIndexPlan) EqualsWithoutChildren

func (p *RecordQueryAggregateIndexPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren compares index plan, record type name, and result type.

func (*RecordQueryAggregateIndexPlan) Explain

Explain renders AggregateIndex(function, indexName, [groupCols], recordType).

func (*RecordQueryAggregateIndexPlan) GetAggColumn

func (p *RecordQueryAggregateIndexPlan) GetAggColumn() string

GetAggColumn returns the aggregate column name.

func (*RecordQueryAggregateIndexPlan) GetAggregateFunction

func (p *RecordQueryAggregateIndexPlan) GetAggregateFunction() string

GetAggregateFunction returns the aggregate function name.

func (*RecordQueryAggregateIndexPlan) GetChildren

GetChildren returns nil — this is a leaf plan. The wrapped index plan is a structural field, not a child (mirrors Java where RecordQueryAggregateIndexPlan implements RecordQueryPlanWithNoChildren).

func (*RecordQueryAggregateIndexPlan) GetGroupCols

func (p *RecordQueryAggregateIndexPlan) GetGroupCols() []string

GetGroupCols returns the grouping column names.

func (*RecordQueryAggregateIndexPlan) GetIndexName

func (p *RecordQueryAggregateIndexPlan) GetIndexName() string

GetIndexName returns the index name from the underlying plan.

func (*RecordQueryAggregateIndexPlan) GetIndexPlan

GetIndexPlan returns the underlying index plan.

func (*RecordQueryAggregateIndexPlan) GetRecordTypeName

func (p *RecordQueryAggregateIndexPlan) GetRecordTypeName() string

GetRecordTypeName returns the base record type name.

func (*RecordQueryAggregateIndexPlan) GetResultType

func (p *RecordQueryAggregateIndexPlan) GetResultType() values.Type

GetResultType returns the aggregate result type.

func (*RecordQueryAggregateIndexPlan) HashCodeWithoutChildren

func (p *RecordQueryAggregateIndexPlan) HashCodeWithoutChildren() uint64

HashCodeWithoutChildren mixes index plan hash, record type, and aggregate function.

func (*RecordQueryAggregateIndexPlan) IsReverse

func (p *RecordQueryAggregateIndexPlan) IsReverse() bool

IsReverse delegates to the underlying index plan.

func (*RecordQueryAggregateIndexPlan) OutputColumnNames

func (p *RecordQueryAggregateIndexPlan) OutputColumnNames() []string

OutputColumnNames returns the column names this plan's rows are keyed by — the grouping columns (verbatim, as the cursor writes them) followed by the canonical aggregate name. A bare aggregate-index plan is always UNALIASED (an aliased SELECT tops with a Project that owns the rename), so there is no alias to carry; these are exactly the keys aggregateIndexCursor writes. Used by planColumnNamesWithMD so a UNION position-remap can normalize a grouped aggregate-index branch (RFC-081).

func (*RecordQueryAggregateIndexPlan) WithGroupColumns

func (p *RecordQueryAggregateIndexPlan) WithGroupColumns(groupCols []string, aggColumn string) *RecordQueryAggregateIndexPlan

WithGroupColumns sets the grouping and aggregate column names for the executor to map index entries to result rows.

type RecordQueryComparatorPlan

type RecordQueryComparatorPlan struct {
	// contains filtered or unexported fields
}

RecordQueryComparatorPlan is a multi-child plan that executes all child plans and compares their results using a comparison key. Results from child plans are assumed to all be in a compatible sort order. Mirrors Java's RecordQueryComparatorPlan.

Fields:

  • children: the list of sub-plans whose results are compared.
  • comparisonKeyValues: values by which the results are compared (equivalent to Java's KeyExpression comparisonKey).
  • referencePlanIndex: the index of the "reference plan" (source of truth) among the sub-plans.
  • reverse: whether the children produce results in reverse order.
  • abortOnComparisonFailure: whether to abort execution when a comparison mismatch is detected (used in testing).

func NewRecordQueryComparatorPlan

func NewRecordQueryComparatorPlan(
	children []RecordQueryPlan,
	comparisonKeyValues []values.Value,
	referencePlanIndex int,
	reverse bool,
	abortOnComparisonFailure bool,
) *RecordQueryComparatorPlan

NewRecordQueryComparatorPlan constructs a comparator plan. Panics if children is empty or referencePlanIndex is out of range.

func (*RecordQueryComparatorPlan) AbortOnComparisonFailure

func (p *RecordQueryComparatorPlan) AbortOnComparisonFailure() bool

AbortOnComparisonFailure reports whether mismatches abort execution.

func (*RecordQueryComparatorPlan) EqualsWithoutChildren

func (p *RecordQueryComparatorPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren compares comparison keys (semantic Value identity — see semanticValueEquals), reference index, and reverse flag. The keys join equality per RFC-176 §1: before P2, equality checked only the key COUNT while the hash folded the full keys, so two plans with equal counts but different keys compared equal yet hashed apart — a live plan-level equal⟹same-hash violation (a hash-first memo lookup misses the "equal" member and inserts a duplicate).

func (*RecordQueryComparatorPlan) Explain

func (p *RecordQueryComparatorPlan) Explain() string

Explain renders Comparator(child1, child2, ..., ref=N).

func (*RecordQueryComparatorPlan) GetChildren

func (p *RecordQueryComparatorPlan) GetChildren() []RecordQueryPlan

GetChildren returns the child plans.

func (*RecordQueryComparatorPlan) GetComparisonKeyValues

func (p *RecordQueryComparatorPlan) GetComparisonKeyValues() []values.Value

GetComparisonKeyValues returns the comparison key values.

func (*RecordQueryComparatorPlan) GetReferencePlanIndex

func (p *RecordQueryComparatorPlan) GetReferencePlanIndex() int

GetReferencePlanIndex returns the index of the reference plan.

func (*RecordQueryComparatorPlan) GetResultType

func (p *RecordQueryComparatorPlan) GetResultType() values.Type

GetResultType returns the first child's result type, or UnknownType if there are no children.

func (*RecordQueryComparatorPlan) HashCodeWithoutChildren

func (p *RecordQueryComparatorPlan) HashCodeWithoutChildren() uint64

HashCodeWithoutChildren mixes comparison keys (semantic Value hashes), reference index, and reverse flag.

func (*RecordQueryComparatorPlan) IsReverse

func (p *RecordQueryComparatorPlan) IsReverse() bool

IsReverse reports the scan direction.

type RecordQueryDefaultOnEmptyPlan

type RecordQueryDefaultOnEmptyPlan struct {
	// contains filtered or unexported fields
}

RecordQueryDefaultOnEmptyPlan returns the inner plan's rows if any exist, or a single row with the default value if the inner is empty. Mirrors Java's RecordQueryDefaultOnEmptyPlan.

func NewRecordQueryDefaultOnEmptyPlan

func NewRecordQueryDefaultOnEmptyPlan(inner RecordQueryPlan, defaultValue values.Value) *RecordQueryDefaultOnEmptyPlan

func (*RecordQueryDefaultOnEmptyPlan) EqualsWithoutChildren

func (p *RecordQueryDefaultOnEmptyPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren compares the default value by semantic Value identity (RFC-176 P2 — see semanticValueEquals).

func (*RecordQueryDefaultOnEmptyPlan) Explain

func (*RecordQueryDefaultOnEmptyPlan) GetChildren

func (*RecordQueryDefaultOnEmptyPlan) GetDefaultValue

func (p *RecordQueryDefaultOnEmptyPlan) GetDefaultValue() values.Value

func (*RecordQueryDefaultOnEmptyPlan) GetInner

func (*RecordQueryDefaultOnEmptyPlan) GetResultType

func (p *RecordQueryDefaultOnEmptyPlan) GetResultType() values.Type

func (*RecordQueryDefaultOnEmptyPlan) HashCodeWithoutChildren

func (p *RecordQueryDefaultOnEmptyPlan) HashCodeWithoutChildren() uint64

type RecordQueryDeletePlan

type RecordQueryDeletePlan struct {
	// contains filtered or unexported fields
}

RecordQueryDeletePlan is the physical DELETE plan: deletes records emitted by an inner plan. Mirrors a simplified subset of Java's `RecordQueryDeletePlan`.

Java's full surface includes pre-delete + post-delete hooks, versionstamp generation, plan-graph rewriting. The seed ports the minimal node-information needed by ImplementDeleteRule:

  • inner: the source plan emitting rows to delete (typically a filter/scan that selects the target rows)
  • targetRecordType: the destination record type name

func NewRecordQueryDeletePlan

func NewRecordQueryDeletePlan(inner RecordQueryPlan, targetRecordType string) *RecordQueryDeletePlan

NewRecordQueryDeletePlan constructs the DELETE plan.

func (*RecordQueryDeletePlan) EqualsWithoutChildren

func (p *RecordQueryDeletePlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren compares targetRecordType.

func (*RecordQueryDeletePlan) Explain

func (p *RecordQueryDeletePlan) Explain() string

Explain renders Delete(target, inner).

func (*RecordQueryDeletePlan) GetChildren

func (p *RecordQueryDeletePlan) GetChildren() []RecordQueryPlan

GetChildren returns the inner plan as the only child.

func (*RecordQueryDeletePlan) GetInner

func (p *RecordQueryDeletePlan) GetInner() RecordQueryPlan

GetInner returns the source plan.

func (*RecordQueryDeletePlan) GetResultType

func (p *RecordQueryDeletePlan) GetResultType() values.Type

GetResultType returns the inner's result type.

func (*RecordQueryDeletePlan) GetTargetRecordType

func (p *RecordQueryDeletePlan) GetTargetRecordType() string

GetTargetRecordType returns the destination record-type name.

func (*RecordQueryDeletePlan) HashCodeWithoutChildren

func (p *RecordQueryDeletePlan) HashCodeWithoutChildren() uint64

HashCodeWithoutChildren mixes class + targetRecordType.

type RecordQueryDistinctPlan

type RecordQueryDistinctPlan struct {
	// contains filtered or unexported fields
}

RecordQueryDistinctPlan removes duplicate rows from an inner plan's row stream. Mirrors Java's `RecordQueryUnorderedPrimaryKeyDistinctPlan` (the simpler unordered-distinct shape — Java has multiple distinct-plan flavors: ordered / unordered / by-key / by-row). The seed picks unordered-by-row.

Result type matches inner — distinct doesn't reshape rows.

func NewRecordQueryDistinctPlan

func NewRecordQueryDistinctPlan(inner RecordQueryPlan) *RecordQueryDistinctPlan

NewRecordQueryDistinctPlan constructs a distinct plan over the given inner plan.

func (*RecordQueryDistinctPlan) EqualsWithoutChildren

func (p *RecordQueryDistinctPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren — distinct plans are interchangeable on node-info alone (no operator-specific data); compares only the concrete type.

func (*RecordQueryDistinctPlan) Explain

func (p *RecordQueryDistinctPlan) Explain() string

Explain renders Distinct(inner).

func (*RecordQueryDistinctPlan) GetChildren

func (p *RecordQueryDistinctPlan) GetChildren() []RecordQueryPlan

GetChildren returns the inner plan as the only child.

func (*RecordQueryDistinctPlan) GetInner

GetInner returns the wrapped inner plan.

func (*RecordQueryDistinctPlan) GetResultType

func (p *RecordQueryDistinctPlan) GetResultType() values.Type

GetResultType returns the inner's result type.

func (*RecordQueryDistinctPlan) HashCodeWithoutChildren

func (p *RecordQueryDistinctPlan) HashCodeWithoutChildren() uint64

HashCodeWithoutChildren is a constant for the type discriminator.

type RecordQueryExplodePlan

type RecordQueryExplodePlan struct {
	// contains filtered or unexported fields
}

RecordQueryExplodePlan "explodes" a collection-typed Value into a stream of element values. Leaf plan (no children). Mirrors Java's RecordQueryExplodePlan.

func NewRecordQueryExplodePlan

func NewRecordQueryExplodePlan(collectionValue values.Value) *RecordQueryExplodePlan

NewRecordQueryExplodePlan builds a bare (non-ordinal) Explode plan.

func NewRecordQueryExplodePlanWithOrdinality

func NewRecordQueryExplodePlanWithOrdinality(collectionValue values.Value, withOrdinality bool) *RecordQueryExplodePlan

NewRecordQueryExplodePlanWithOrdinality builds an Explode plan that also emits a 1-based ordinal alongside each element.

func (*RecordQueryExplodePlan) EqualsWithoutChildren

func (p *RecordQueryExplodePlan) EqualsWithoutChildren(other RecordQueryPlan) bool

func (*RecordQueryExplodePlan) Explain

func (p *RecordQueryExplodePlan) Explain() string

func (*RecordQueryExplodePlan) GetChildren

func (p *RecordQueryExplodePlan) GetChildren() []RecordQueryPlan

func (*RecordQueryExplodePlan) GetCollectionValue

func (p *RecordQueryExplodePlan) GetCollectionValue() values.Value

func (*RecordQueryExplodePlan) GetElementType

func (p *RecordQueryExplodePlan) GetElementType() values.Type

GetElementType returns the array element type, or UnknownType when the collection is not array-typed.

func (*RecordQueryExplodePlan) GetResultType

func (p *RecordQueryExplodePlan) GetResultType() values.Type

func (*RecordQueryExplodePlan) HashCodeWithoutChildren

func (p *RecordQueryExplodePlan) HashCodeWithoutChildren() uint64

func (*RecordQueryExplodePlan) IsWithOrdinality

func (p *RecordQueryExplodePlan) IsWithOrdinality() bool

IsWithOrdinality reports whether the plan emits 1-based ordinals.

type RecordQueryFetchFromPartialRecordPlan

type RecordQueryFetchFromPartialRecordPlan struct {
	// contains filtered or unexported fields
}

RecordQueryFetchFromPartialRecordPlan transforms a stream of partial records (index entries from a covering index scan) into full records by fetching via primary key. Mirrors Java's `RecordQueryFetchFromPartialRecordPlan`.

The plan has:

  • An inner plan that produces index entries (partial records).
  • A TranslateValueFunction that maps values from the full-record domain to the partial-record (index) domain — used by push-through rules to determine which predicates/values can be evaluated before the fetch.
  • A result type (the full record type post-fetch).
  • A FetchIndexRecords mode.

func NewRecordQueryFetchFromPartialRecordPlan

func NewRecordQueryFetchFromPartialRecordPlan(
	inner RecordQueryPlan,
	translateValueFunction TranslateValueFunction,
	resultType values.Type,
	fetchIndexRecords FetchIndexRecords,
) *RecordQueryFetchFromPartialRecordPlan

NewRecordQueryFetchFromPartialRecordPlan constructs the plan.

func (*RecordQueryFetchFromPartialRecordPlan) EqualsWithoutChildren

func (p *RecordQueryFetchFromPartialRecordPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren compares fetch mode (inner is the caller's responsibility via children).

func (*RecordQueryFetchFromPartialRecordPlan) Explain

Explain renders Fetch(inner).

func (*RecordQueryFetchFromPartialRecordPlan) GetChildren

GetChildren returns the inner plan.

func (*RecordQueryFetchFromPartialRecordPlan) GetFetchIndexRecords

func (p *RecordQueryFetchFromPartialRecordPlan) GetFetchIndexRecords() FetchIndexRecords

GetFetchIndexRecords returns the fetch mode.

func (*RecordQueryFetchFromPartialRecordPlan) GetInner

GetInner returns the inner plan (typically a covering index scan).

func (*RecordQueryFetchFromPartialRecordPlan) GetResultType

GetResultType returns the full record type post-fetch.

func (*RecordQueryFetchFromPartialRecordPlan) GetTranslateValueFunction

func (p *RecordQueryFetchFromPartialRecordPlan) GetTranslateValueFunction() TranslateValueFunction

GetTranslateValueFunction returns the push-value function.

func (*RecordQueryFetchFromPartialRecordPlan) HashCodeWithoutChildren

func (p *RecordQueryFetchFromPartialRecordPlan) HashCodeWithoutChildren() uint64

HashCodeWithoutChildren mixes type discriminator + fetch mode.

func (*RecordQueryFetchFromPartialRecordPlan) IsReverse

IsReverse delegates to the inner plan's reverse flag. Mirrors Java's RecordQueryFetchFromPartialRecordPlan.isReverse() which returns getChild().isReverse().

func (*RecordQueryFetchFromPartialRecordPlan) PushValue

PushValue attempts to translate a value from the full-record domain (correlated to sourceAlias) to the partial-record domain (correlated to targetAlias). Returns the translated value and true on success, or nil and false if translation is not possible.

Mirrors Java's `RecordQueryFetchFromPartialRecordPlan.pushValue`.

type RecordQueryFilterPlan

type RecordQueryFilterPlan struct {
	// contains filtered or unexported fields
}

RecordQueryFilterPlan applies a list of QueryPredicates to an inner plan's row stream. Mirrors Java's `RecordQueryFilterPlan`.

Seed surface: predicates list + inner plan. The plan's result type is the inner's result type (filter doesn't reshape rows).

Note: physical filter (the row-by-row ANDed predicate evaluation) vs logical filter (the LogicalFilterExpression rule input) are separate concepts. ImplementFilterRule (B5 Batch A) lifts a LogicalFilter into this plan.

func NewRecordQueryFilterPlan

func NewRecordQueryFilterPlan(preds []predicates.QueryPredicate, inner RecordQueryPlan) *RecordQueryFilterPlan

NewRecordQueryFilterPlan constructs a filter over the given predicates and inner plan.

func (*RecordQueryFilterPlan) EqualsWithoutChildren

func (p *RecordQueryFilterPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren compares the predicate list pairwise via PredicateEquals.

func (*RecordQueryFilterPlan) Explain

func (p *RecordQueryFilterPlan) Explain() string

Explain renders Filter([P1, P2], inner).

func (*RecordQueryFilterPlan) GetChildren

func (p *RecordQueryFilterPlan) GetChildren() []RecordQueryPlan

GetChildren returns the inner plan as the only child.

func (*RecordQueryFilterPlan) GetInner

func (p *RecordQueryFilterPlan) GetInner() RecordQueryPlan

GetInner returns the wrapped inner plan.

func (*RecordQueryFilterPlan) GetPredicates

func (p *RecordQueryFilterPlan) GetPredicates() []predicates.QueryPredicate

GetPredicates returns the predicate list (read-only).

func (*RecordQueryFilterPlan) GetResultType

func (p *RecordQueryFilterPlan) GetResultType() values.Type

GetResultType returns the inner's result type (filter doesn't reshape rows).

func (*RecordQueryFilterPlan) HashCodeWithoutChildren

func (p *RecordQueryFilterPlan) HashCodeWithoutChildren() uint64

HashCodeWithoutChildren mixes the class discriminator + per- predicate Explain-rendered text. Explain is stable across calls for stable predicates (PredicateEquals's underlying contract — see predicates.PredicateEquals doc), so two semantically-equal predicate lists hash to the same value.

type RecordQueryFirstOrDefaultPlan

type RecordQueryFirstOrDefaultPlan struct {
	// contains filtered or unexported fields
}

RecordQueryFirstOrDefaultPlan takes the first row from the inner plan, or returns a default value if the inner plan produces no rows. Mirrors Java's `RecordQueryFirstOrDefaultPlan`.

func NewRecordQueryFirstOrDefaultPlan

func NewRecordQueryFirstOrDefaultPlan(inner RecordQueryPlan, defaultValue values.Value) *RecordQueryFirstOrDefaultPlan

NewRecordQueryFirstOrDefaultPlan constructs a first-or-default plan over the given inner plan and default value.

func (*RecordQueryFirstOrDefaultPlan) EqualsWithoutChildren

func (p *RecordQueryFirstOrDefaultPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren compares the default value by semantic Value identity (RFC-176 P2 — see semanticValueEquals).

func (*RecordQueryFirstOrDefaultPlan) Explain

Explain renders FirstOrDefault(inner).

func (*RecordQueryFirstOrDefaultPlan) GetChildren

GetChildren returns the inner plan as the only child.

func (*RecordQueryFirstOrDefaultPlan) GetDefaultValue

func (p *RecordQueryFirstOrDefaultPlan) GetDefaultValue() values.Value

GetDefaultValue returns the fallback value used when the inner plan is empty.

func (*RecordQueryFirstOrDefaultPlan) GetInner

GetInner returns the wrapped inner plan.

func (*RecordQueryFirstOrDefaultPlan) GetResultType

func (p *RecordQueryFirstOrDefaultPlan) GetResultType() values.Type

GetResultType returns the inner's result type.

func (*RecordQueryFirstOrDefaultPlan) HashCodeWithoutChildren

func (p *RecordQueryFirstOrDefaultPlan) HashCodeWithoutChildren() uint64

HashCodeWithoutChildren mixes the class discriminator + default value's semantic hash (see writeValueHash).

type RecordQueryFlatMapPlan

type RecordQueryFlatMapPlan struct {
	// contains filtered or unexported fields
}

RecordQueryFlatMapPlan represents a correlated nested-loop join where for each outer row, the inner plan is re-executed with the outer row bound as a correlation. Mirrors Java's RecordQueryFlatMapPlan which uses FlatMapPipelinedCursor for execution.

The key difference from RecordQueryNestedLoopJoinPlan: the inner plan is parameterized by the outer row via correlation bindings. This enables targeted index probes on the inner side (O(N×logM) vs O(N×M)).

func NewRecordQueryFlatMapPlan

func NewRecordQueryFlatMapPlan(
	outer, inner RecordQueryPlan,
	outerAlias, innerAlias values.CorrelationIdentifier,
	resultValue values.Value,
	inheritOuterRecordProperties bool,
) *RecordQueryFlatMapPlan

func (*RecordQueryFlatMapPlan) EqualsWithoutChildren

func (p *RecordQueryFlatMapPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

func (*RecordQueryFlatMapPlan) Explain

func (p *RecordQueryFlatMapPlan) Explain() string

func (*RecordQueryFlatMapPlan) GetChildren

func (p *RecordQueryFlatMapPlan) GetChildren() []RecordQueryPlan

func (*RecordQueryFlatMapPlan) GetInner

func (*RecordQueryFlatMapPlan) GetInnerAlias

func (*RecordQueryFlatMapPlan) GetOuter

func (*RecordQueryFlatMapPlan) GetOuterAlias

func (*RecordQueryFlatMapPlan) GetResultType

func (p *RecordQueryFlatMapPlan) GetResultType() values.Type

func (*RecordQueryFlatMapPlan) GetResultValue

func (p *RecordQueryFlatMapPlan) GetResultValue() values.Value

func (*RecordQueryFlatMapPlan) HashCodeWithoutChildren

func (p *RecordQueryFlatMapPlan) HashCodeWithoutChildren() uint64

func (*RecordQueryFlatMapPlan) InheritOuterRecordProperties

func (p *RecordQueryFlatMapPlan) InheritOuterRecordProperties() bool

func (*RecordQueryFlatMapPlan) IsLeftOuter

func (p *RecordQueryFlatMapPlan) IsLeftOuter() bool

func (*RecordQueryFlatMapPlan) SetLeftOuter

func (p *RecordQueryFlatMapPlan) SetLeftOuter(v bool)

type RecordQueryInJoinPlan

type RecordQueryInJoinPlan struct {
	// contains filtered or unexported fields
}

RecordQueryInJoinPlan executes its inner plan once for each value from an IN-source, binding the value to a correlation variable. The result is the concatenation of all inner executions.

Mirrors Java's RecordQueryInJoinPlan hierarchy (InValuesJoin, InParameterJoin, InComparandJoin).

func NewRecordQueryInJoinPlan

func NewRecordQueryInJoinPlan(
	inner RecordQueryPlan,
	bindingName string,
	sorted bool,
	reverse bool,
) *RecordQueryInJoinPlan

func (*RecordQueryInJoinPlan) EqualsWithoutChildren

func (p *RecordQueryInJoinPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

func (*RecordQueryInJoinPlan) Explain

func (p *RecordQueryInJoinPlan) Explain() string

func (*RecordQueryInJoinPlan) GetBindingName

func (p *RecordQueryInJoinPlan) GetBindingName() string

func (*RecordQueryInJoinPlan) GetChildren

func (p *RecordQueryInJoinPlan) GetChildren() []RecordQueryPlan

func (*RecordQueryInJoinPlan) GetInValues

func (p *RecordQueryInJoinPlan) GetInValues() []any

func (*RecordQueryInJoinPlan) GetInner

func (p *RecordQueryInJoinPlan) GetInner() RecordQueryPlan

func (*RecordQueryInJoinPlan) GetResultType

func (p *RecordQueryInJoinPlan) GetResultType() values.Type

func (*RecordQueryInJoinPlan) GetSourceKind

func (p *RecordQueryInJoinPlan) GetSourceKind() InSourceKind

func (*RecordQueryInJoinPlan) HashCodeWithoutChildren

func (p *RecordQueryInJoinPlan) HashCodeWithoutChildren() uint64

func (*RecordQueryInJoinPlan) IsReverse

func (p *RecordQueryInJoinPlan) IsReverse() bool

func (*RecordQueryInJoinPlan) IsSorted

func (p *RecordQueryInJoinPlan) IsSorted() bool

func (*RecordQueryInJoinPlan) SetInValues

func (p *RecordQueryInJoinPlan) SetInValues(vals []any)

func (*RecordQueryInJoinPlan) SetSourceKind

func (p *RecordQueryInJoinPlan) SetSourceKind(k InSourceKind)

type RecordQueryInMemorySortPlan

type RecordQueryInMemorySortPlan struct {
	// contains filtered or unexported fields
}

RecordQueryInMemorySortPlan materializes the inner plan's output and sorts it in memory.

Go extension — Java's Cascades has no physical sort operator.

Cascades still optimizes the inner plan (index scans, predicate pushdown, join ordering). Only the final sort is post-processed. The cost model ensures index-based sort elimination is preferred when an index exists.

func NewRecordQueryInMemorySortPlan

func NewRecordQueryInMemorySortPlan(inner RecordQueryPlan, sortKeys []SortKey) *RecordQueryInMemorySortPlan

func (*RecordQueryInMemorySortPlan) EqualsWithoutChildren

func (p *RecordQueryInMemorySortPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

func (*RecordQueryInMemorySortPlan) Explain

func (p *RecordQueryInMemorySortPlan) Explain() string

func (*RecordQueryInMemorySortPlan) GetChildren

func (p *RecordQueryInMemorySortPlan) GetChildren() []RecordQueryPlan

func (*RecordQueryInMemorySortPlan) GetInner

func (*RecordQueryInMemorySortPlan) GetResultType

func (p *RecordQueryInMemorySortPlan) GetResultType() values.Type

func (*RecordQueryInMemorySortPlan) GetSortKeys

func (p *RecordQueryInMemorySortPlan) GetSortKeys() []SortKey

func (*RecordQueryInMemorySortPlan) HashCodeWithoutChildren

func (p *RecordQueryInMemorySortPlan) HashCodeWithoutChildren() uint64

type RecordQueryInUnionPlan

type RecordQueryInUnionPlan struct {
	// contains filtered or unexported fields
}

RecordQueryInUnionPlan is the IN-union variant: the inner plan is executed once per IN-source value, and results are merge-sorted by comparison keys. Mirrors Java's RecordQueryInUnionOnValuesPlan.

func NewRecordQueryInUnionPlan

func NewRecordQueryInUnionPlan(
	inner RecordQueryPlan,
	bindingNames []string,
	comparisonKeys []values.Value,
	reverse bool,
) *RecordQueryInUnionPlan

func NewRecordQueryInUnionPlanWithMaxSize

func NewRecordQueryInUnionPlanWithMaxSize(
	inner RecordQueryPlan,
	bindingNames []string,
	comparisonKeys []values.Value,
	reverse bool,
	maxSize int,
) *RecordQueryInUnionPlan

func (*RecordQueryInUnionPlan) EqualsWithoutChildren

func (p *RecordQueryInUnionPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

func (*RecordQueryInUnionPlan) Explain

func (p *RecordQueryInUnionPlan) Explain() string

func (*RecordQueryInUnionPlan) GetBindingNames

func (p *RecordQueryInUnionPlan) GetBindingNames() []string

func (*RecordQueryInUnionPlan) GetChildren

func (p *RecordQueryInUnionPlan) GetChildren() []RecordQueryPlan

func (*RecordQueryInUnionPlan) GetComparisonKeys

func (p *RecordQueryInUnionPlan) GetComparisonKeys() []values.Value

func (*RecordQueryInUnionPlan) GetInSources

func (p *RecordQueryInUnionPlan) GetInSources() [][]any

func (*RecordQueryInUnionPlan) GetInner

func (*RecordQueryInUnionPlan) GetMaxSize

func (p *RecordQueryInUnionPlan) GetMaxSize() int

func (*RecordQueryInUnionPlan) GetResultType

func (p *RecordQueryInUnionPlan) GetResultType() values.Type

func (*RecordQueryInUnionPlan) HashCodeWithoutChildren

func (p *RecordQueryInUnionPlan) HashCodeWithoutChildren() uint64

func (*RecordQueryInUnionPlan) IsReverse

func (p *RecordQueryInUnionPlan) IsReverse() bool

func (*RecordQueryInUnionPlan) SetInSources

func (p *RecordQueryInUnionPlan) SetInSources(sources [][]any)

type RecordQueryIndexPlan

type RecordQueryIndexPlan struct {
	// contains filtered or unexported fields
}

RecordQueryIndexPlan is an index scan over a secondary index — reads index entries whose key prefix satisfies the scan comparisons, then fetches the corresponding records. Mirrors Java's `RecordQueryIndexPlan`.

Seed surface:

  • IndexName: name of the index being scanned.
  • ScanComparisons: ordered list of ComparisonRanges (one per index key column, left-to-right). The prefix defines the FDB key range: equality ranges become exact prefix bytes, the first inequality becomes range bounds, and the rest are empty (full scan for those suffix columns).
  • RecordTypes: which record types the index covers.
  • Reverse: scan direction.
  • FlowedType: rich Type of the row stream.

The index scan is a LEAF in the plan tree — it reads directly from FDB (the index subspace). A follow-up fetch step may be needed if the index is non-covering; that lands as a separate plan node (RecordQueryFetchFromPartialRecordPlan in Java) when covering-index rules port.

func NewRecordQueryIndexPlan

func NewRecordQueryIndexPlan(
	indexName string,
	scanComparisons []*predicates.ComparisonRange,
	recordTypes []string,
	flowedType values.Type,
	reverse bool,
) *RecordQueryIndexPlan

NewRecordQueryIndexPlan constructs an index scan plan.

func (*RecordQueryIndexPlan) EqualsWithoutChildren

func (p *RecordQueryIndexPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren compares index name, scan comparisons, record types, and reverse flag.

func (*RecordQueryIndexPlan) Explain

func (p *RecordQueryIndexPlan) Explain() string

Explain renders a one-line label.

func (*RecordQueryIndexPlan) GetChildren

func (p *RecordQueryIndexPlan) GetChildren() []RecordQueryPlan

GetChildren returns nil — index scans are leaves.

func (*RecordQueryIndexPlan) GetCoveringColumns

func (p *RecordQueryIndexPlan) GetCoveringColumns() []string

GetCoveringColumns returns the index column names when covering.

func (*RecordQueryIndexPlan) GetFlowedType

func (p *RecordQueryIndexPlan) GetFlowedType() values.Type

GetFlowedType returns the rich row Type.

func (*RecordQueryIndexPlan) GetIndexName

func (p *RecordQueryIndexPlan) GetIndexName() string

GetIndexName returns the index name.

func (*RecordQueryIndexPlan) GetRecordTypes

func (p *RecordQueryIndexPlan) GetRecordTypes() []string

GetRecordTypes returns the covered record types.

func (*RecordQueryIndexPlan) GetResultType

func (p *RecordQueryIndexPlan) GetResultType() values.Type

GetResultType returns the row Type.

func (*RecordQueryIndexPlan) GetScanComparisons

func (p *RecordQueryIndexPlan) GetScanComparisons() []*predicates.ComparisonRange

GetScanComparisons returns the per-column comparison ranges.

func (*RecordQueryIndexPlan) HashCodeWithoutChildren

func (p *RecordQueryIndexPlan) HashCodeWithoutChildren() uint64

HashCodeWithoutChildren mixes index name + scan comparison types + reverse flag.

func (*RecordQueryIndexPlan) IsCovering

func (p *RecordQueryIndexPlan) IsCovering() bool

IsCovering reports whether the index provides all columns needed by the query, eliminating the need to fetch the full record by PK.

func (*RecordQueryIndexPlan) IsReverse

func (p *RecordQueryIndexPlan) IsReverse() bool

IsReverse reports the scan direction.

func (*RecordQueryIndexPlan) IsStrictlySorted

func (p *RecordQueryIndexPlan) IsStrictlySorted() bool

IsStrictlySorted reports whether the scan's ordering uniquely determines each record (no two adjacent records share the same key). Set by RemoveSortRule when DISTINCT covers all ordering keys or a unique index satisfies the full key set.

func (*RecordQueryIndexPlan) WithCovering

func (p *RecordQueryIndexPlan) WithCovering(columns []string) *RecordQueryIndexPlan

WithCovering returns a shallow copy marked as a covering index scan.

func (*RecordQueryIndexPlan) WithScanComparisons

func (p *RecordQueryIndexPlan) WithScanComparisons(comps []*predicates.ComparisonRange) *RecordQueryIndexPlan

WithScanComparisons returns a copy of the plan with new per-column comparison ranges, preserving every other field (covering/coveringColumns/strictlySorted/ reverse/flowedType/recordTypes). Used by the RFC-153 buried-merge correlation rebase to rewrite a SARG comparand without losing the index's covering metadata.

func (*RecordQueryIndexPlan) WithStrictlySorted

func (p *RecordQueryIndexPlan) WithStrictlySorted() *RecordQueryIndexPlan

WithStrictlySorted returns a shallow copy with strictlySorted=true.

type RecordQueryInsertPlan

type RecordQueryInsertPlan struct {
	// contains filtered or unexported fields
}

RecordQueryInsertPlan is the physical INSERT plan: consumes rows from an inner plan and writes them to the target record type. Mirrors a simplified subset of Java's `RecordQueryInsertPlan` (which extends RecordQueryAbstractDataModificationPlan).

Java's full surface includes per-record transforms, save-record behaviour flags, plan-graph rewriting hooks. The seed ports the minimal node-information needed by ImplementInsertRule:

  • inner: the source plan producing rows to insert
  • targetRecordType: the destination record type name
  • targetType: the rich Type the inserted rows must conform to

Result type matches inner — INSERT typically returns the inserted rows for cursor consumption.

Execute is NOT in the seed surface — wiring to FDBRecordStore is a follow-up shift gated on the rule chain producing these plans.

func NewRecordQueryInsertPlan

func NewRecordQueryInsertPlan(inner RecordQueryPlan, targetRecordType string, targetType values.Type) *RecordQueryInsertPlan

NewRecordQueryInsertPlan constructs the INSERT plan.

func (*RecordQueryInsertPlan) EqualsWithoutChildren

func (p *RecordQueryInsertPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren compares targetRecordType + targetType.

func (*RecordQueryInsertPlan) Explain

func (p *RecordQueryInsertPlan) Explain() string

Explain renders Insert(target, inner).

func (*RecordQueryInsertPlan) GetChildren

func (p *RecordQueryInsertPlan) GetChildren() []RecordQueryPlan

GetChildren returns the inner plan as the only child.

func (*RecordQueryInsertPlan) GetInner

func (p *RecordQueryInsertPlan) GetInner() RecordQueryPlan

GetInner returns the source plan.

func (*RecordQueryInsertPlan) GetResultType

func (p *RecordQueryInsertPlan) GetResultType() values.Type

GetResultType returns the inner's result type — INSERT typically returns the inserted rows for cursor consumption.

func (*RecordQueryInsertPlan) GetTargetRecordType

func (p *RecordQueryInsertPlan) GetTargetRecordType() string

GetTargetRecordType returns the destination record-type name.

func (*RecordQueryInsertPlan) GetTargetType

func (p *RecordQueryInsertPlan) GetTargetType() values.Type

GetTargetType returns the rich Type the inserted rows must conform to.

func (*RecordQueryInsertPlan) HashCodeWithoutChildren

func (p *RecordQueryInsertPlan) HashCodeWithoutChildren() uint64

HashCodeWithoutChildren mixes class + targetRecordType.

type RecordQueryIntersectionPlan

type RecordQueryIntersectionPlan struct {
	// contains filtered or unexported fields
}

RecordQueryIntersectionPlan emits the bag-intersection of its inner plans — rows that appear in EVERY inner stream, compared by the comparison-key columns. Mirrors Java's `RecordQueryIntersectionPlan`.

Java has multiple intersection-plan flavors (ordered, unordered, primary-key-based, value-based). The seed ports the simplest: generic N-way intersection over a comparison-key column list. Specialised flavors land when their consumers do.

All inners must produce row-compatible streams (planner's responsibility); the comparison-key columns are matched against each row to determine intersection membership.

func NewRecordQueryIntersectionPlan

func NewRecordQueryIntersectionPlan(inners []RecordQueryPlan, comparisonKeyValues []values.Value) *RecordQueryIntersectionPlan

NewRecordQueryIntersectionPlan constructs an N-way intersection. `comparisonKeyValues` defines the row-equality key (typically the primary-key columns of the result type).

func (*RecordQueryIntersectionPlan) EqualsWithoutChildren

func (p *RecordQueryIntersectionPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren matches IntersectionPlan + same-shape comparison-key list (length only — Value-level equality lives at the Value layer's SemanticEquals).

func (*RecordQueryIntersectionPlan) Explain

func (p *RecordQueryIntersectionPlan) Explain() string

Explain renders Intersection(inner1, inner2, ...).

func (*RecordQueryIntersectionPlan) GetChildren

func (p *RecordQueryIntersectionPlan) GetChildren() []RecordQueryPlan

GetChildren returns the inner plans.

func (*RecordQueryIntersectionPlan) GetComparisonKeyValues

func (p *RecordQueryIntersectionPlan) GetComparisonKeyValues() []values.Value

GetComparisonKeyValues returns the row-equality key list (read-only).

func (*RecordQueryIntersectionPlan) GetInners

GetInners returns the intersection's inner plans (read-only).

func (*RecordQueryIntersectionPlan) GetResultType

func (p *RecordQueryIntersectionPlan) GetResultType() values.Type

GetResultType returns the first inner's result type, or UnknownType if there are no inners.

func (*RecordQueryIntersectionPlan) HashCodeWithoutChildren

func (p *RecordQueryIntersectionPlan) HashCodeWithoutChildren() uint64

HashCodeWithoutChildren hashes the type discriminator + the comparison-key column count.

type RecordQueryLimitPlan

type RecordQueryLimitPlan struct {
	// contains filtered or unexported fields
}

RecordQueryLimitPlan caps the result row count and optionally skips rows from an inner plan. Mirrors Java's fetch/limit plan operators.

limitValue is an OPTIONAL runtime row cap: when non-nil the executor evaluates it against the bound parameters at execution time and uses the result as the cap, ignoring the static `limit` field. It exists so a distance-ordered vector scan can be bounded by a PARAMETERIZED QUALIFY rank (`ROW_NUMBER() OVER (ORDER BY distance(...)) <= ?`): the K is unknown at plan time, so the cap must be carried as a Value (RFC-156). For a runtime limit the static `limit` is set to the no-cap sentinel (-1) so it is never mistaken for a literal LIMIT 0; the no-op-limit elimination / limit-merge rules decline on a non-nil limitValue rather than reading the sentinel.

func NewRecordQueryLimitPlan

func NewRecordQueryLimitPlan(inner RecordQueryPlan, limit, offset int64) *RecordQueryLimitPlan

func NewRecordQueryLimitPlanWithValue

func NewRecordQueryLimitPlanWithValue(inner RecordQueryPlan, limitValue values.Value, offset int64) *RecordQueryLimitPlan

NewRecordQueryLimitPlanWithValue builds a LIMIT whose row cap is a runtime Value, evaluated at execution against the bound parameters. The static limit is the no-cap sentinel (-1); only limitValue is consulted.

func (*RecordQueryLimitPlan) EqualsWithoutChildren

func (p *RecordQueryLimitPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

func (*RecordQueryLimitPlan) Explain

func (p *RecordQueryLimitPlan) Explain() string

func (*RecordQueryLimitPlan) GetChildren

func (p *RecordQueryLimitPlan) GetChildren() []RecordQueryPlan

func (*RecordQueryLimitPlan) GetInner

func (p *RecordQueryLimitPlan) GetInner() RecordQueryPlan

GetInner exposes the single child so generic single-inner walkers (deriveColumnsFromPlan, findScanPlan, findIndexPlan, …) can descend through the limit — it is a row-count cap, transparent to column derivation and ordering. Without this the LIMIT plan, when it sits at the root (RFC-128 made the top-level LIMIT a real operator), is opaque to column derivation and the result columns resolve wrong.

func (*RecordQueryLimitPlan) GetLimit

func (p *RecordQueryLimitPlan) GetLimit() int64

func (*RecordQueryLimitPlan) GetLimitValue

func (p *RecordQueryLimitPlan) GetLimitValue() values.Value

GetLimitValue returns the optional runtime row-cap Value (nil for a static literal LIMIT).

func (*RecordQueryLimitPlan) GetOffset

func (p *RecordQueryLimitPlan) GetOffset() int64

func (*RecordQueryLimitPlan) GetResultType

func (p *RecordQueryLimitPlan) GetResultType() values.Type

func (*RecordQueryLimitPlan) HashCodeWithoutChildren

func (p *RecordQueryLimitPlan) HashCodeWithoutChildren() uint64

func (*RecordQueryLimitPlan) WithInner

WithInner returns a shallow copy bound to a new inner plan, preserving the cap (static or runtime). Used when an implementation rule rebuilds the wrapper around a folded leaf so the runtime limitValue is never dropped.

type RecordQueryLoadByKeysPlan

type RecordQueryLoadByKeysPlan struct {
	// contains filtered or unexported fields
}

RecordQueryLoadByKeysPlan returns records whose primary keys are taken from a KeysSource. This is a leaf plan (no children). Mirrors Java's RecordQueryLoadByKeysPlan.

func NewRecordQueryLoadByKeysPlan

func NewRecordQueryLoadByKeysPlan(keysSource KeysSource) *RecordQueryLoadByKeysPlan

NewRecordQueryLoadByKeysPlan constructs the plan from a KeysSource.

func NewRecordQueryLoadByKeysPlanFromKeys

func NewRecordQueryLoadByKeysPlanFromKeys(primaryKeys []tuple.Tuple) *RecordQueryLoadByKeysPlan

NewRecordQueryLoadByKeysPlanFromKeys constructs the plan from an explicit list of primary key tuples.

func NewRecordQueryLoadByKeysPlanFromParameter

func NewRecordQueryLoadByKeysPlanFromParameter(parameter string) *RecordQueryLoadByKeysPlan

NewRecordQueryLoadByKeysPlanFromParameter constructs the plan from a named parameter.

func (*RecordQueryLoadByKeysPlan) EqualsWithoutChildren

func (p *RecordQueryLoadByKeysPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren compares the key sources.

func (*RecordQueryLoadByKeysPlan) Explain

func (p *RecordQueryLoadByKeysPlan) Explain() string

Explain renders LoadByKeys(source).

func (*RecordQueryLoadByKeysPlan) GetChildren

func (p *RecordQueryLoadByKeysPlan) GetChildren() []RecordQueryPlan

GetChildren returns nil — this is a leaf plan.

func (*RecordQueryLoadByKeysPlan) GetKeysSource

func (p *RecordQueryLoadByKeysPlan) GetKeysSource() KeysSource

GetKeysSource returns the key source.

func (*RecordQueryLoadByKeysPlan) GetResultType

func (p *RecordQueryLoadByKeysPlan) GetResultType() values.Type

GetResultType returns UnknownType — the actual type depends on the record type loaded at execution time.

func (*RecordQueryLoadByKeysPlan) HashCodeWithoutChildren

func (p *RecordQueryLoadByKeysPlan) HashCodeWithoutChildren() uint64

HashCodeWithoutChildren mixes the type discriminator + key source string representation.

type RecordQueryMapPlan

type RecordQueryMapPlan struct {
	// contains filtered or unexported fields
}

RecordQueryMapPlan applies a transformation value to each row produced by an inner plan. Mirrors Java's `RecordQueryMapPlan`.

The resultValue defines the output shape — its Type() becomes the plan's result type, and at execution time each inner row is fed through the value's Evaluate to produce the output row.

func NewRecordQueryMapPlan

func NewRecordQueryMapPlan(inner RecordQueryPlan, resultValue values.Value) *RecordQueryMapPlan

NewRecordQueryMapPlan constructs a map plan over the given inner plan and result value.

func (*RecordQueryMapPlan) EqualsWithoutChildren

func (p *RecordQueryMapPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren compares the result value by semantic Value identity (RFC-176 P2 — see semanticValueEquals), Java's RecordQueryMapPlan.equalsWithoutChildren → semanticEqualsForResults.

func (*RecordQueryMapPlan) Explain

func (p *RecordQueryMapPlan) Explain() string

Explain renders Map(inner, result).

func (*RecordQueryMapPlan) GetChildren

func (p *RecordQueryMapPlan) GetChildren() []RecordQueryPlan

GetChildren returns the inner plan as the only child.

func (*RecordQueryMapPlan) GetInner

func (p *RecordQueryMapPlan) GetInner() RecordQueryPlan

GetInner returns the wrapped inner plan.

func (*RecordQueryMapPlan) GetResultType

func (p *RecordQueryMapPlan) GetResultType() values.Type

GetResultType returns the result value's type.

func (*RecordQueryMapPlan) GetResultValue

func (p *RecordQueryMapPlan) GetResultValue() values.Value

GetResultValue returns the transformation value.

func (*RecordQueryMapPlan) HashCodeWithoutChildren

func (p *RecordQueryMapPlan) HashCodeWithoutChildren() uint64

HashCodeWithoutChildren mixes the class discriminator + result value's semantic hash (see writeValueHash).

type RecordQueryMergeSortUnionPlan

type RecordQueryMergeSortUnionPlan struct {
	// contains filtered or unexported fields
}

RecordQueryMergeSortUnionPlan is the ordered (merge-sorted) union variant. Children must produce rows sorted by the comparison keys; the plan merges them maintaining that order. Optionally deduplicates rows that have equal comparison keys.

Mirrors Java's RecordQueryUnionOnValuesPlan (which extends RecordQueryUnionPlan with comparison key values + reverse flag + distinct flag).

func NewRecordQueryMergeSortUnionPlan

func NewRecordQueryMergeSortUnionPlan(
	inners []RecordQueryPlan,
	comparisonKeys []values.Value,
	reverse bool,
	removeDuplicates bool,
) *RecordQueryMergeSortUnionPlan

func (*RecordQueryMergeSortUnionPlan) EqualsWithoutChildren

func (p *RecordQueryMergeSortUnionPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren compares reverse + removeDuplicates flags and the comparison keys (semantic Value identity — see semanticValueEquals). The keys join equality per RFC-176 §1: before P2, equality checked only the key COUNT while the hash folded the full keys — different-key plans compared equal yet hashed apart, a live plan-level equal⟹same-hash violation.

func (*RecordQueryMergeSortUnionPlan) Explain

func (*RecordQueryMergeSortUnionPlan) GetChildren

func (*RecordQueryMergeSortUnionPlan) GetComparisonKeys

func (p *RecordQueryMergeSortUnionPlan) GetComparisonKeys() []values.Value

func (*RecordQueryMergeSortUnionPlan) GetInners

func (*RecordQueryMergeSortUnionPlan) GetResultType

func (p *RecordQueryMergeSortUnionPlan) GetResultType() values.Type

func (*RecordQueryMergeSortUnionPlan) HashCodeWithoutChildren

func (p *RecordQueryMergeSortUnionPlan) HashCodeWithoutChildren() uint64

func (*RecordQueryMergeSortUnionPlan) IsReverse

func (p *RecordQueryMergeSortUnionPlan) IsReverse() bool

func (*RecordQueryMergeSortUnionPlan) RemovesDuplicates

func (p *RecordQueryMergeSortUnionPlan) RemovesDuplicates() bool

type RecordQueryMultiIntersectionOnValuesPlan

type RecordQueryMultiIntersectionOnValuesPlan struct {
	// contains filtered or unexported fields
}

RecordQueryMultiIntersectionOnValuesPlan merges N input streams where all streams are ordered by the same comparison key (grouping columns). For each group of rows where the comparison key matches across ALL streams, it produces one output row combining:

  • Common values (grouping columns) — taken from any stream (they're identical)
  • Pick-up values (aggregates) — one from each stream

Mirrors Java's RecordQueryMultiIntersectionOnValuesPlan which extends RecordQueryIntersectionPlan and adds a resultValue that constructs the merged output row from quantifier bindings.

func NewRecordQueryMultiIntersectionOnValuesPlan

func NewRecordQueryMultiIntersectionOnValuesPlan(
	children []RecordQueryPlan,
	comparisonKey []values.Value,
	resultValue values.Value,
) *RecordQueryMultiIntersectionOnValuesPlan

NewRecordQueryMultiIntersectionOnValuesPlan constructs an N-way multi-intersection. comparisonKey defines the row-equality key (grouping columns); resultValue is the Value expression that constructs the output row from quantifier bindings.

func (*RecordQueryMultiIntersectionOnValuesPlan) EqualsWithoutChildren

func (p *RecordQueryMultiIntersectionOnValuesPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren matches MultiIntersectionOnValuesPlan with the same comparison key and resultValue by semantic Value identity (RFC-176 P2 — see semanticValueEquals).

func (*RecordQueryMultiIntersectionOnValuesPlan) Explain

Explain renders MultiIntersection(child1, child2, ...; keys=[...]).

func (*RecordQueryMultiIntersectionOnValuesPlan) GetChildren

GetChildren returns the input plans.

func (*RecordQueryMultiIntersectionOnValuesPlan) GetComparisonKey

func (p *RecordQueryMultiIntersectionOnValuesPlan) GetComparisonKey() []values.Value

GetComparisonKey returns the grouping-column values used to match rows across all input streams.

func (*RecordQueryMultiIntersectionOnValuesPlan) GetResultType

GetResultType returns the result Value's type if a resultValue is set, or UnknownType otherwise.

func (*RecordQueryMultiIntersectionOnValuesPlan) GetResultValue

GetResultValue returns the Value expression that constructs the merged output row.

func (*RecordQueryMultiIntersectionOnValuesPlan) HashCodeWithoutChildren

func (p *RecordQueryMultiIntersectionOnValuesPlan) HashCodeWithoutChildren() uint64

HashCodeWithoutChildren folds the type discriminator, comparison key values, and result value (semantic Value hashes — see writeValueHash).

type RecordQueryNestedLoopJoinPlan

type RecordQueryNestedLoopJoinPlan struct {
	// contains filtered or unexported fields
}

RecordQueryNestedLoopJoinPlan represents a nested-loop join of two child plans. For each row in the outer (left) plan, the inner (right) plan is evaluated and the join predicate is applied to the combined row. This is the simplest and most general join strategy — it handles all join types (inner, left, cross) without requiring ordered input.

Mirrors Java's `com.apple.foundationdb.record.query.plan.plans.RecordQueryFlatMapPlan` which is the underlying implementation of nested-loop joins in the Record Layer.

func NewRecordQueryNestedLoopJoinPlan

func NewRecordQueryNestedLoopJoinPlan(
	outer, inner RecordQueryPlan,
	joinPredicates []predicates.QueryPredicate,
	joinType JoinType,
	outerAlias, innerAlias string,
	resultValue values.Value,
) *RecordQueryNestedLoopJoinPlan

NewRecordQueryNestedLoopJoinPlan constructs a nested-loop join plan. outerAlias/innerAlias are the SQL-level table aliases (e.g. "E", "M" for `FROM Employee AS e, Employee AS m`). Used by the executor to qualify merged-row keys so predicates can resolve alias-qualified column references.

func (*RecordQueryNestedLoopJoinPlan) EqualsWithoutChildren

func (p *RecordQueryNestedLoopJoinPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

func (*RecordQueryNestedLoopJoinPlan) Explain

func (*RecordQueryNestedLoopJoinPlan) GetChildren

func (*RecordQueryNestedLoopJoinPlan) GetInner

func (*RecordQueryNestedLoopJoinPlan) GetInnerAlias

func (p *RecordQueryNestedLoopJoinPlan) GetInnerAlias() string

func (*RecordQueryNestedLoopJoinPlan) GetJoinType

func (p *RecordQueryNestedLoopJoinPlan) GetJoinType() JoinType

func (*RecordQueryNestedLoopJoinPlan) GetOuter

func (*RecordQueryNestedLoopJoinPlan) GetOuterAlias

func (p *RecordQueryNestedLoopJoinPlan) GetOuterAlias() string

func (*RecordQueryNestedLoopJoinPlan) GetPredicates

func (*RecordQueryNestedLoopJoinPlan) GetResultType

func (p *RecordQueryNestedLoopJoinPlan) GetResultType() values.Type

func (*RecordQueryNestedLoopJoinPlan) GetResultValue

func (p *RecordQueryNestedLoopJoinPlan) GetResultValue() values.Value

func (*RecordQueryNestedLoopJoinPlan) HashCodeWithoutChildren

func (p *RecordQueryNestedLoopJoinPlan) HashCodeWithoutChildren() uint64

type RecordQueryPlan

type RecordQueryPlan interface {
	// GetResultType returns the rich Type of rows this plan emits.
	// Always a RelationType.
	GetResultType() values.Type

	// GetChildren returns this plan's input plans, in stable order.
	// Read-only; callers must not mutate.
	GetChildren() []RecordQueryPlan

	// EqualsWithoutChildren reports whether this plan's node-
	// information matches `other`'s. Children are not consulted —
	// caller's job (typically by recursing into GetChildren).
	EqualsWithoutChildren(other RecordQueryPlan) bool

	// HashCodeWithoutChildren returns the structural hash of this
	// node's node-information. Must be consistent with
	// EqualsWithoutChildren: x.Equals(y) implies x.Hash() == y.Hash().
	HashCodeWithoutChildren() uint64

	// Explain returns a single-line human-readable label for this
	// plan node. Implementations should match Java's
	// `Plan.toString()` shape where reasonable.
	Explain() string
}

RecordQueryPlan is the root interface for every physical plan node. Mirrors Java's `RecordQueryPlan` interface — implementations produce a record stream when executed against an FDBRecordStore.

The seed exposes node-information accessors (GetResultType, GetChildren, EqualsWithoutChildren, HashCodeWithoutChildren) and an Explain method for diagnostic rendering. Execute is NOT in the seed surface — wiring to FDBRecordStore is a follow-up shift gated on the rule chain being able to produce these plans end-to-end.

type RecordQueryPredicatesFilterPlan

type RecordQueryPredicatesFilterPlan struct {
	// contains filtered or unexported fields
}

RecordQueryPredicatesFilterPlan applies a list of QueryPredicates to an inner plan's row stream. Mirrors Java's `RecordQueryPredicatesFilterPlan`.

Unlike RecordQueryFilterPlan (which also takes QueryPredicates), this variant is produced by ImplementSimpleSelectRule and models the Cascades-era predicate-filter operator that works with the richer predicate hierarchy (ValuePredicate, ExistentialValuePredicate, etc.) rather than the legacy comparison-based filter.

func NewRecordQueryPredicatesFilterPlan

func NewRecordQueryPredicatesFilterPlan(inner RecordQueryPlan, preds []predicates.QueryPredicate) *RecordQueryPredicatesFilterPlan

NewRecordQueryPredicatesFilterPlan constructs a predicates filter over the given inner plan and predicate list.

func NewRecordQueryPredicatesFilterPlanWithAlias

func NewRecordQueryPredicatesFilterPlanWithAlias(inner RecordQueryPlan, preds []predicates.QueryPredicate, alias values.CorrelationIdentifier) *RecordQueryPredicatesFilterPlan

NewRecordQueryPredicatesFilterPlanWithAlias constructs a predicates filter that binds the current row as a correlation under innerAlias before evaluating predicates. Mirrors Java's evalFilter which calls context.withBinding(CORRELATION, getInner().getAlias(), queryResult).

func (*RecordQueryPredicatesFilterPlan) EqualsWithoutChildren

func (p *RecordQueryPredicatesFilterPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren compares the predicate list pairwise via PredicateEquals.

func (*RecordQueryPredicatesFilterPlan) Explain

Explain renders PredicatesFilter(inner, [pred1, pred2, ...]).

func (*RecordQueryPredicatesFilterPlan) GetChildren

GetChildren returns the inner plan as the only child.

func (*RecordQueryPredicatesFilterPlan) GetInner

GetInner returns the wrapped inner plan.

func (*RecordQueryPredicatesFilterPlan) GetInnerAlias

GetInnerAlias returns the correlation alias under which the current row is bound during predicate evaluation. Zero value means no binding.

func (*RecordQueryPredicatesFilterPlan) GetPredicates

GetPredicates returns the predicate list (read-only).

func (*RecordQueryPredicatesFilterPlan) GetResultType

func (p *RecordQueryPredicatesFilterPlan) GetResultType() values.Type

GetResultType returns the inner's result type (filter doesn't reshape rows).

func (*RecordQueryPredicatesFilterPlan) HashCodeWithoutChildren

func (p *RecordQueryPredicatesFilterPlan) HashCodeWithoutChildren() uint64

HashCodeWithoutChildren mixes the class discriminator + per- predicate Explain-rendered text.

type RecordQueryProjectionPlan

type RecordQueryProjectionPlan struct {
	// contains filtered or unexported fields
}

RecordQueryProjectionPlan applies a projection (column selection / expression evaluation) over an inner plan's row stream. Mirrors Java's conceptual projection in RecordQueryFetchFromPartialRecordPlan / the MapPipelinedCursor mechanics. The seed models it as a distinct plan node for clarity.

func NewRecordQueryProjectionPlan

func NewRecordQueryProjectionPlan(projections []values.Value, inner RecordQueryPlan) *RecordQueryProjectionPlan

func NewRecordQueryProjectionPlanWithAliases

func NewRecordQueryProjectionPlanWithAliases(projections []values.Value, aliases []string, inner RecordQueryPlan) *RecordQueryProjectionPlan

func (*RecordQueryProjectionPlan) EqualsWithoutChildren

func (p *RecordQueryProjectionPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren compares the projection lists by semantic Value identity (RFC-176 P2 — see semanticValueEquals): Java's model (RecordQueryMapPlan.equalsWithoutChildren → semanticEqualsForResults), where every semantic discriminator a projected Value carries — in particular a plan-time-resolved ordinal accessor (values.NewFieldValueWithResolvedOrdinal, the recursive-CTE duplicate-alias wrap; Java: distinct ofOrdinalNumber ordinals are distinct FieldPaths) — joins identity structurally. Two reads of duplicate-named slots differ ONLY by ordinal, so unifying them would let extraction pick a plan reading the WRONG slot.

NOTE(explain format, RFC-176 P3): identity was previously keyed on the ExplainValue renderings, which therefore had to be injective over every semantic discriminator — the origin of the '#'-escape (raw '#' doubled, ordinal reads rendered "X#0"; PR #446 rounds 2-3). After P2 no identity code path reads a rendering; rendering is for humans, identity is structural. The escape is RETAINED as an explain-format guarantee — debugging output that collapses two different reads is still a bug — and its tests (TestFieldValue_ExplainOrdinalEscape_RFC173, the plans-level TestProjectionPlan_Identity_OrdinalVsLiteralHashField) now pin exactly that, plus the matching injective discriminator in writeSemanticHash's FieldValue arm.

func (*RecordQueryProjectionPlan) Explain

func (p *RecordQueryProjectionPlan) Explain() string

func (*RecordQueryProjectionPlan) GetAliases

func (p *RecordQueryProjectionPlan) GetAliases() []string

func (*RecordQueryProjectionPlan) GetChildren

func (p *RecordQueryProjectionPlan) GetChildren() []RecordQueryPlan

func (*RecordQueryProjectionPlan) GetInner

func (*RecordQueryProjectionPlan) GetProjections

func (p *RecordQueryProjectionPlan) GetProjections() []values.Value

func (*RecordQueryProjectionPlan) GetResultType

func (p *RecordQueryProjectionPlan) GetResultType() values.Type

func (*RecordQueryProjectionPlan) HashCodeWithoutChildren

func (p *RecordQueryProjectionPlan) HashCodeWithoutChildren() uint64

func (*RecordQueryProjectionPlan) IsIdentity

func (p *RecordQueryProjectionPlan) IsIdentity() bool

IsIdentity returns true if this projection passes all columns through unchanged (a QuantifiedObjectValue that references the inner's alias). An identity projection can be removed without changing the output shape.

type RecordQueryRecursiveDfsJoinPlan

type RecordQueryRecursiveDfsJoinPlan struct {
	// contains filtered or unexported fields
}

RecordQueryRecursiveDfsJoinPlan implements a recursive depth-first join: the root plan seeds the traversal, and the child plan is re-evaluated for each row using priorCorrelation to bind the "prior" row. Mirrors Java's `com.apple.foundationdb.record.query.plan.plans.RecordQueryRecursiveDfsJoinPlan`.

func NewRecordQueryRecursiveDfsJoinPlan

func NewRecordQueryRecursiveDfsJoinPlan(
	root, child RecordQueryPlan,
	priorCorrelation values.CorrelationIdentifier,
	strategy DfsTraversalStrategy,
) *RecordQueryRecursiveDfsJoinPlan

func NewRecordQueryRecursiveDfsJoinPlanDistinct

func NewRecordQueryRecursiveDfsJoinPlanDistinct(
	root, child RecordQueryPlan,
	priorCorrelation values.CorrelationIdentifier,
	strategy DfsTraversalStrategy,
) *RecordQueryRecursiveDfsJoinPlan

NewRecordQueryRecursiveDfsJoinPlanDistinct creates a DFS plan with UNION DISTINCT deduplication.

func (*RecordQueryRecursiveDfsJoinPlan) EqualsWithoutChildren

func (p *RecordQueryRecursiveDfsJoinPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

func (*RecordQueryRecursiveDfsJoinPlan) Explain

func (*RecordQueryRecursiveDfsJoinPlan) GetChild

func (*RecordQueryRecursiveDfsJoinPlan) GetChildren

func (*RecordQueryRecursiveDfsJoinPlan) GetPriorCorrelation

func (*RecordQueryRecursiveDfsJoinPlan) GetResultType

func (p *RecordQueryRecursiveDfsJoinPlan) GetResultType() values.Type

func (*RecordQueryRecursiveDfsJoinPlan) GetRoot

func (*RecordQueryRecursiveDfsJoinPlan) GetTraversalStrategy

func (p *RecordQueryRecursiveDfsJoinPlan) GetTraversalStrategy() DfsTraversalStrategy

func (*RecordQueryRecursiveDfsJoinPlan) HashCodeWithoutChildren

func (p *RecordQueryRecursiveDfsJoinPlan) HashCodeWithoutChildren() uint64

func (*RecordQueryRecursiveDfsJoinPlan) IsDistinct

func (p *RecordQueryRecursiveDfsJoinPlan) IsDistinct() bool

type RecordQueryRecursiveLevelUnionPlan

type RecordQueryRecursiveLevelUnionPlan struct {
	// contains filtered or unexported fields
}

RecordQueryRecursiveLevelUnionPlan implements a recursive level-order (breadth-first) union: the initial-state plan seeds the first level, and the recursive-state plan is re-evaluated for each level using two temp tables (scan/insert) that are flipped between levels. Mirrors Java's RecordQueryRecursiveLevelUnionPlan.

func NewRecordQueryRecursiveLevelUnionPlan

func NewRecordQueryRecursiveLevelUnionPlan(
	initialState, recursiveState RecordQueryPlan,
	tempTableScanAlias, tempTableInsertAlias values.CorrelationIdentifier,
) *RecordQueryRecursiveLevelUnionPlan

func NewRecordQueryRecursiveLevelUnionPlanDistinct

func NewRecordQueryRecursiveLevelUnionPlanDistinct(
	initialState, recursiveState RecordQueryPlan,
	tempTableScanAlias, tempTableInsertAlias values.CorrelationIdentifier,
) *RecordQueryRecursiveLevelUnionPlan

NewRecordQueryRecursiveLevelUnionPlanDistinct creates a plan with UNION DISTINCT deduplication.

func (*RecordQueryRecursiveLevelUnionPlan) EqualsWithoutChildren

func (p *RecordQueryRecursiveLevelUnionPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

func (*RecordQueryRecursiveLevelUnionPlan) Explain

func (*RecordQueryRecursiveLevelUnionPlan) GetChildren

func (*RecordQueryRecursiveLevelUnionPlan) GetInitialState

func (*RecordQueryRecursiveLevelUnionPlan) GetRecursiveState

func (p *RecordQueryRecursiveLevelUnionPlan) GetRecursiveState() RecordQueryPlan

func (*RecordQueryRecursiveLevelUnionPlan) GetResultType

func (p *RecordQueryRecursiveLevelUnionPlan) GetResultType() values.Type

func (*RecordQueryRecursiveLevelUnionPlan) GetTempTableInsertAlias

func (*RecordQueryRecursiveLevelUnionPlan) GetTempTableScanAlias

func (*RecordQueryRecursiveLevelUnionPlan) HashCodeWithoutChildren

func (p *RecordQueryRecursiveLevelUnionPlan) HashCodeWithoutChildren() uint64

func (*RecordQueryRecursiveLevelUnionPlan) IsDistinct

func (p *RecordQueryRecursiveLevelUnionPlan) IsDistinct() bool

type RecordQueryScanPlan

type RecordQueryScanPlan struct {
	// contains filtered or unexported fields
}

RecordQueryScanPlan is a primary-key scan over a set of record types — the leaf physical-plan that reads records sequentially from the FDB store. Mirrors Java's `RecordQueryScanPlan`.

Seed surface:

  • RecordTypes: which record types to emit. Empty = all types.
  • FlowedType: the rich Type of the row stream (RecordType for a single type, UnionType for multi-type scans).
  • Reverse: whether to scan in reverse PK order.

What's NOT in the seed: range bounds, scan-property bag, continuation, scan-comparison thunk. Those land when consumers (Batch A index rules) need them.

func NewRecordQueryScanPlan

func NewRecordQueryScanPlan(recordTypes []string, flowedType values.Type, reverse bool) *RecordQueryScanPlan

NewRecordQueryScanPlan builds a scan over the given record types in the given direction. recordTypes is normalised (sorted + deduped); empty slice → scan over all types.

func (*RecordQueryScanPlan) EqualsWithoutChildren

func (p *RecordQueryScanPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

func (*RecordQueryScanPlan) Explain

func (p *RecordQueryScanPlan) Explain() string

Explain renders a one-line label.

func (*RecordQueryScanPlan) GetChildren

func (p *RecordQueryScanPlan) GetChildren() []RecordQueryPlan

GetChildren returns the empty slice — scans are leaves.

func (*RecordQueryScanPlan) GetFlowedType

func (p *RecordQueryScanPlan) GetFlowedType() values.Type

GetFlowedType returns the rich Type of rows flowing out.

func (*RecordQueryScanPlan) GetPrimaryKeyValues

func (p *RecordQueryScanPlan) GetPrimaryKeyValues() []values.Value

GetPrimaryKeyValues returns the primary key values, or nil if not set.

func (*RecordQueryScanPlan) GetRecordTypes

func (p *RecordQueryScanPlan) GetRecordTypes() []string

GetRecordTypes returns the canonical record-type-name list.

func (*RecordQueryScanPlan) GetResultType

func (p *RecordQueryScanPlan) GetResultType() values.Type

GetResultType returns the row Type — same as FlowedType for the seed (no per-row projection in a scan).

func (*RecordQueryScanPlan) GetScanComparisons

func (p *RecordQueryScanPlan) GetScanComparisons() []*predicates.ComparisonRange

GetScanComparisons returns the per-column comparison ranges for PK narrowing.

func (*RecordQueryScanPlan) HashCodeWithoutChildren

func (p *RecordQueryScanPlan) HashCodeWithoutChildren() uint64

func (*RecordQueryScanPlan) IsReverse

func (p *RecordQueryScanPlan) IsReverse() bool

IsReverse reports the scan direction.

func (*RecordQueryScanPlan) WithPrimaryKey

func (p *RecordQueryScanPlan) WithPrimaryKey(pk []values.Value) *RecordQueryScanPlan

WithPrimaryKey returns a copy of the scan plan with PK values set.

func (*RecordQueryScanPlan) WithScanComparisons

func (p *RecordQueryScanPlan) WithScanComparisons(comps []*predicates.ComparisonRange) *RecordQueryScanPlan

WithScanComparisons returns a copy with the given scan comparisons. Mirrors Java's RecordQueryScanPlan constructor that accepts ScanComparisons.

type RecordQueryScoreForRankPlan

type RecordQueryScoreForRankPlan struct {
	// contains filtered or unexported fields
}

RecordQueryScoreForRankPlan wraps an inner plan and evaluates rank/score functions, binding the results into the evaluation context so the inner plan can use them as parameters. Mirrors Java's RecordQueryScoreForRankPlan.

This is a STRUCTURE-ONLY port — no execution logic.

func NewRecordQueryScoreForRankPlan

func NewRecordQueryScoreForRankPlan(inner RecordQueryPlan, ranks []ScoreForRank) *RecordQueryScoreForRankPlan

NewRecordQueryScoreForRankPlan constructs a score-for-rank plan.

func (*RecordQueryScoreForRankPlan) EqualsWithoutChildren

func (p *RecordQueryScoreForRankPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren compares the ranks list.

func (*RecordQueryScoreForRankPlan) Explain

func (p *RecordQueryScoreForRankPlan) Explain() string

Explain renders ScoreForRank([rank1, rank2], inner).

func (*RecordQueryScoreForRankPlan) GetChildren

func (p *RecordQueryScoreForRankPlan) GetChildren() []RecordQueryPlan

GetChildren returns the inner plan as the only child.

func (*RecordQueryScoreForRankPlan) GetInner

GetInner returns the wrapped inner plan.

func (*RecordQueryScoreForRankPlan) GetRanks

func (p *RecordQueryScoreForRankPlan) GetRanks() []ScoreForRank

GetRanks returns the list of ScoreForRank entries.

func (*RecordQueryScoreForRankPlan) GetResultType

func (p *RecordQueryScoreForRankPlan) GetResultType() values.Type

GetResultType returns the inner plan's result type (score-for-rank doesn't reshape rows — it binds scores into the evaluation context, then delegates row production to the inner plan).

func (*RecordQueryScoreForRankPlan) HashCodeWithoutChildren

func (p *RecordQueryScoreForRankPlan) HashCodeWithoutChildren() uint64

HashCodeWithoutChildren mixes the class discriminator + ranks.

func (*RecordQueryScoreForRankPlan) IsReverse

func (p *RecordQueryScoreForRankPlan) IsReverse() bool

IsReverse delegates to the inner plan.

type RecordQuerySelectorPlan

type RecordQuerySelectorPlan struct {
	// contains filtered or unexported fields
}

RecordQuerySelectorPlan selects one of its children to be executed at runtime. The selector determines which child plan to use via a PlanSelector policy. Mirrors Java's RecordQuerySelectorPlan.

func NewRecordQuerySelectorPlan

func NewRecordQuerySelectorPlan(
	children []RecordQueryPlan,
	planSelector PlanSelector,
	reverse bool,
) *RecordQuerySelectorPlan

NewRecordQuerySelectorPlan constructs a selector plan. Panics if children is empty.

func NewRecordQuerySelectorPlanWithProbabilities

func NewRecordQuerySelectorPlanWithProbabilities(
	children []RecordQueryPlan,
	probabilities []int,
	reverse bool,
) *RecordQuerySelectorPlan

NewRecordQuerySelectorPlanWithProbabilities constructs a selector plan using relative probabilities. Panics if the list lengths differ or children is empty.

func (*RecordQuerySelectorPlan) EqualsWithoutChildren

func (p *RecordQuerySelectorPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren compares reverse flag and plan selector.

func (*RecordQuerySelectorPlan) Explain

func (p *RecordQuerySelectorPlan) Explain() string

Explain renders Selector(child1, child2, ..., selector).

func (*RecordQuerySelectorPlan) GetChildren

func (p *RecordQuerySelectorPlan) GetChildren() []RecordQueryPlan

GetChildren returns the child plans.

func (*RecordQuerySelectorPlan) GetPlanSelector

func (p *RecordQuerySelectorPlan) GetPlanSelector() PlanSelector

GetPlanSelector returns the plan selector.

func (*RecordQuerySelectorPlan) GetResultType

func (p *RecordQuerySelectorPlan) GetResultType() values.Type

GetResultType returns the first child's result type, or UnknownType if there are no children.

func (*RecordQuerySelectorPlan) HashCodeWithoutChildren

func (p *RecordQuerySelectorPlan) HashCodeWithoutChildren() uint64

HashCodeWithoutChildren mixes reverse flag and plan selector label.

func (*RecordQuerySelectorPlan) IsReverse

func (p *RecordQuerySelectorPlan) IsReverse() bool

IsReverse reports the scan direction.

type RecordQuerySortPlan

type RecordQuerySortPlan struct {
	// contains filtered or unexported fields
}

RecordQuerySortPlan sorts an inner plan's row stream by a list of sort keys. Mirrors Java's `RecordQuerySortPlan`.

The sort key reuses the logical-side `expressions.SortKey` shape (Value + reverse flag) — physical and logical sort specifications share the same descriptor type since the only difference is which plan tree they live in.

func NewRecordQuerySortPlan

func NewRecordQuerySortPlan(sortKeys []expressions.SortKey, inner RecordQueryPlan) *RecordQuerySortPlan

NewRecordQuerySortPlan constructs a sort plan over the given keys and inner plan. sortKeys is copied.

func (*RecordQuerySortPlan) EqualsWithoutChildren

func (p *RecordQuerySortPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren compares sort key Values (semantic Value identity, RFC-176 P2 — see semanticValueEquals) + reverse flags pairwise.

func (*RecordQuerySortPlan) Explain

func (p *RecordQuerySortPlan) Explain() string

Explain renders Sort([k1, k2 DESC], inner).

func (*RecordQuerySortPlan) GetChildren

func (p *RecordQuerySortPlan) GetChildren() []RecordQueryPlan

GetChildren returns the inner plan as the only child.

func (*RecordQuerySortPlan) GetInner

func (p *RecordQuerySortPlan) GetInner() RecordQueryPlan

GetInner returns the wrapped inner plan.

func (*RecordQuerySortPlan) GetResultType

func (p *RecordQuerySortPlan) GetResultType() values.Type

GetResultType returns the inner's result type — sort doesn't reshape rows.

func (*RecordQuerySortPlan) GetSortKeys

func (p *RecordQuerySortPlan) GetSortKeys() []expressions.SortKey

GetSortKeys returns the sort key list (read-only).

func (*RecordQuerySortPlan) HashCodeWithoutChildren

func (p *RecordQuerySortPlan) HashCodeWithoutChildren() uint64

HashCodeWithoutChildren mixes the class discriminator + per-key semantic Value hash + reverse flags.

type RecordQueryStreamingAggregationPlan

type RecordQueryStreamingAggregationPlan struct {
	// contains filtered or unexported fields
}

RecordQueryStreamingAggregationPlan groups input rows by grouping keys and computes aggregates over each group in a streaming fashion. The plan requires that the inner plan produces rows already sorted by the grouping keys — no materialisation needed.

Mirrors Java's RecordQueryStreamingAggregationPlan: the streaming operator reads sorted input and emits one output row per change in the grouping-key combination. When the inner is NOT ordered by grouping keys, ImplementStreamingAggregationRule does not fire — a sort is needed first, or the hash-aggregate path (future) is used instead.

func NewRecordQueryStreamingAggregationPlan

func NewRecordQueryStreamingAggregationPlan(
	inner RecordQueryPlan,
	groupingKeys []values.Value,
	aggregates []expressions.AggregateSpec,
) *RecordQueryStreamingAggregationPlan

func (*RecordQueryStreamingAggregationPlan) EqualsWithoutChildren

func (p *RecordQueryStreamingAggregationPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

func (*RecordQueryStreamingAggregationPlan) Explain

func (*RecordQueryStreamingAggregationPlan) GetAggregates

func (*RecordQueryStreamingAggregationPlan) GetChildren

func (*RecordQueryStreamingAggregationPlan) GetGroupingKeys

func (p *RecordQueryStreamingAggregationPlan) GetGroupingKeys() []values.Value

func (*RecordQueryStreamingAggregationPlan) GetInner

func (*RecordQueryStreamingAggregationPlan) GetResultType

func (p *RecordQueryStreamingAggregationPlan) GetResultType() values.Type

func (*RecordQueryStreamingAggregationPlan) HashCodeWithoutChildren

func (p *RecordQueryStreamingAggregationPlan) HashCodeWithoutChildren() uint64

type RecordQueryTableFunctionPlan

type RecordQueryTableFunctionPlan struct {
	// contains filtered or unexported fields
}

RecordQueryTableFunctionPlan delegates row-stream production to an underlying streaming Value (e.g. RangeValue). Leaf plan (no children). Mirrors Java's RecordQueryTableFunctionPlan.

func NewRecordQueryTableFunctionPlan

func NewRecordQueryTableFunctionPlan(streamValue values.Value) *RecordQueryTableFunctionPlan

func (*RecordQueryTableFunctionPlan) EqualsWithoutChildren

func (p *RecordQueryTableFunctionPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

func (*RecordQueryTableFunctionPlan) Explain

func (p *RecordQueryTableFunctionPlan) Explain() string

func (*RecordQueryTableFunctionPlan) GetChildren

func (p *RecordQueryTableFunctionPlan) GetChildren() []RecordQueryPlan

func (*RecordQueryTableFunctionPlan) GetResultType

func (p *RecordQueryTableFunctionPlan) GetResultType() values.Type

func (*RecordQueryTableFunctionPlan) GetStreamValue

func (p *RecordQueryTableFunctionPlan) GetStreamValue() values.Value

func (*RecordQueryTableFunctionPlan) HashCodeWithoutChildren

func (p *RecordQueryTableFunctionPlan) HashCodeWithoutChildren() uint64

type RecordQueryTempTableInsertPlan

type RecordQueryTempTableInsertPlan struct {
	// contains filtered or unexported fields
}

RecordQueryTempTableInsertPlan inserts the output of an inner plan into a temporary table identified by a correlation alias. The owning flag controls whether this plan owns the temp table lifecycle. Mirrors Java's `com.apple.foundationdb.record.query.plan.plans.RecordQueryTempTableInsertPlan`.

func NewRecordQueryTempTableInsertPlan

func NewRecordQueryTempTableInsertPlan(
	inner RecordQueryPlan,
	alias values.CorrelationIdentifier,
	owning bool,
) *RecordQueryTempTableInsertPlan

func (*RecordQueryTempTableInsertPlan) EqualsWithoutChildren

func (p *RecordQueryTempTableInsertPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

func (*RecordQueryTempTableInsertPlan) Explain

func (*RecordQueryTempTableInsertPlan) GetChildren

func (*RecordQueryTempTableInsertPlan) GetInner

func (*RecordQueryTempTableInsertPlan) GetResultType

func (p *RecordQueryTempTableInsertPlan) GetResultType() values.Type

func (*RecordQueryTempTableInsertPlan) GetTempTableAlias

func (*RecordQueryTempTableInsertPlan) HashCodeWithoutChildren

func (p *RecordQueryTempTableInsertPlan) HashCodeWithoutChildren() uint64

func (*RecordQueryTempTableInsertPlan) IsOwning

func (p *RecordQueryTempTableInsertPlan) IsOwning() bool

type RecordQueryTempTableScanPlan

type RecordQueryTempTableScanPlan struct {
	// contains filtered or unexported fields
}

RecordQueryTempTableScanPlan scans a temporary table identified by a correlation alias. Mirrors Java's `com.apple.foundationdb.record.query.plan.plans.RecordQueryTempTableScanPlan`.

func (*RecordQueryTempTableScanPlan) EqualsWithoutChildren

func (p *RecordQueryTempTableScanPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

func (*RecordQueryTempTableScanPlan) Explain

func (p *RecordQueryTempTableScanPlan) Explain() string

func (*RecordQueryTempTableScanPlan) GetChildren

func (p *RecordQueryTempTableScanPlan) GetChildren() []RecordQueryPlan

func (*RecordQueryTempTableScanPlan) GetResultType

func (p *RecordQueryTempTableScanPlan) GetResultType() values.Type

func (*RecordQueryTempTableScanPlan) GetTempTableAlias

func (*RecordQueryTempTableScanPlan) HashCodeWithoutChildren

func (p *RecordQueryTempTableScanPlan) HashCodeWithoutChildren() uint64

type RecordQueryTextIndexPlan

type RecordQueryTextIndexPlan struct {
	// contains filtered or unexported fields
}

RecordQueryTextIndexPlan executes a text index scan. Text indexes work differently from regular indexes — the comparison on a query might be split into multiple sub-scans that are intersected or unioned. Mirrors Java's RecordQueryTextIndexPlan.

This is a STRUCTURE-ONLY port — no execution logic. It implements RecordQueryPlan as a leaf plan (no children).

func NewRecordQueryTextIndexPlan

func NewRecordQueryTextIndexPlan(indexName string, textScan TextScan, reverse bool) *RecordQueryTextIndexPlan

NewRecordQueryTextIndexPlan constructs a text index plan.

func (*RecordQueryTextIndexPlan) EqualsWithoutChildren

func (p *RecordQueryTextIndexPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren compares index name, text scan, and reverse.

func (*RecordQueryTextIndexPlan) Explain

func (p *RecordQueryTextIndexPlan) Explain() string

Explain renders TextIndexScan(indexName, textComparison).

func (*RecordQueryTextIndexPlan) GetChildren

func (p *RecordQueryTextIndexPlan) GetChildren() []RecordQueryPlan

GetChildren returns nil — text index scans are leaves.

func (*RecordQueryTextIndexPlan) GetIndexName

func (p *RecordQueryTextIndexPlan) GetIndexName() string

GetIndexName returns the index name.

func (*RecordQueryTextIndexPlan) GetResultType

func (p *RecordQueryTextIndexPlan) GetResultType() values.Type

GetResultType returns UnknownType — the text index plan's result type is determined at execution time from the index metadata. Mirrors Java where getResultValue() returns new QueriedValue() (untyped).

func (*RecordQueryTextIndexPlan) GetTextScan

func (p *RecordQueryTextIndexPlan) GetTextScan() TextScan

GetTextScan returns the text scan descriptor.

func (*RecordQueryTextIndexPlan) HashCodeWithoutChildren

func (p *RecordQueryTextIndexPlan) HashCodeWithoutChildren() uint64

HashCodeWithoutChildren mixes index name + text scan + reverse.

func (*RecordQueryTextIndexPlan) IsReverse

func (p *RecordQueryTextIndexPlan) IsReverse() bool

IsReverse reports the scan direction.

type RecordQueryTypeFilterPlan

type RecordQueryTypeFilterPlan struct {
	// contains filtered or unexported fields
}

RecordQueryTypeFilterPlan filters an inner plan's row stream to only those records of one of the specified record types. Mirrors Java's `RecordQueryTypeFilterPlan`.

Uses the record-type discriminator (the implicit int64 ID FDB records carry) to filter without inspecting the row payload.

Result type: same as inner (filter doesn't reshape rows).

func NewRecordQueryTypeFilterPlan

func NewRecordQueryTypeFilterPlan(recordTypes []string, inner RecordQueryPlan) *RecordQueryTypeFilterPlan

NewRecordQueryTypeFilterPlan constructs a type-filter over the given record-type set + inner plan.

func (*RecordQueryTypeFilterPlan) EqualsWithoutChildren

func (p *RecordQueryTypeFilterPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren compares record-type sets.

func (*RecordQueryTypeFilterPlan) Explain

func (p *RecordQueryTypeFilterPlan) Explain() string

Explain renders TypeFilter([T1, T2], inner).

func (*RecordQueryTypeFilterPlan) GetChildren

func (p *RecordQueryTypeFilterPlan) GetChildren() []RecordQueryPlan

GetChildren returns the inner plan as the only child.

func (*RecordQueryTypeFilterPlan) GetInner

GetInner returns the wrapped inner plan.

func (*RecordQueryTypeFilterPlan) GetRecordTypes

func (p *RecordQueryTypeFilterPlan) GetRecordTypes() []string

GetRecordTypes returns the canonical record-type-name list.

func (*RecordQueryTypeFilterPlan) GetResultType

func (p *RecordQueryTypeFilterPlan) GetResultType() values.Type

GetResultType returns the inner's result type.

func (*RecordQueryTypeFilterPlan) HashCodeWithoutChildren

func (p *RecordQueryTypeFilterPlan) HashCodeWithoutChildren() uint64

HashCodeWithoutChildren mixes class + record-type set.

type RecordQueryUnionPlan

type RecordQueryUnionPlan struct {
	// contains filtered or unexported fields
}

RecordQueryUnionPlan emits the rows of all input plans concatenated. Mirrors Java's `RecordQueryUnionPlan` (the simple UNION ALL variant).

Java has multiple union-plan flavors keyed on dedup vs no-dedup and on key-expression vs values comparison. The seed ports the simplest: UNION ALL with no dedup.

Result type matches the first inner's result type. All inners must produce row-compatible streams (the planner's responsibility).

func NewRecordQueryUnionPlan

func NewRecordQueryUnionPlan(inners []RecordQueryPlan) *RecordQueryUnionPlan

NewRecordQueryUnionPlan constructs a UNION ALL over the given inner plans.

func (*RecordQueryUnionPlan) EqualsWithoutChildren

func (p *RecordQueryUnionPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren is a constant-discriminated equality — union has no operator-specific node-info beyond its children.

func (*RecordQueryUnionPlan) Explain

func (p *RecordQueryUnionPlan) Explain() string

Explain renders Union(inner1, inner2, ...).

func (*RecordQueryUnionPlan) GetChildren

func (p *RecordQueryUnionPlan) GetChildren() []RecordQueryPlan

GetChildren returns the inner plans.

func (*RecordQueryUnionPlan) GetInners

func (p *RecordQueryUnionPlan) GetInners() []RecordQueryPlan

GetInners returns the union's inner plans (read-only).

func (*RecordQueryUnionPlan) GetResultType

func (p *RecordQueryUnionPlan) GetResultType() values.Type

GetResultType returns the first inner's result type, or UnknownType if there are no inners.

func (*RecordQueryUnionPlan) HashCodeWithoutChildren

func (p *RecordQueryUnionPlan) HashCodeWithoutChildren() uint64

HashCodeWithoutChildren is a constant for the type discriminator.

type RecordQueryUnorderedPrimaryKeyDistinctPlan

type RecordQueryUnorderedPrimaryKeyDistinctPlan struct {
	// contains filtered or unexported fields
}

RecordQueryUnorderedPrimaryKeyDistinctPlan removes duplicate rows by means of a hash set of primary keys already seen. Unlike RecordQueryDistinctPlan (which deduplicates by full row), this plan deduplicates by primary key only — two rows with the same PK but different projected columns collapse to one.

Mirrors Java's RecordQueryUnorderedPrimaryKeyDistinctPlan. This is a single-child plan: it wraps an inner plan and filters its output stream.

This is a STRUCTURE-ONLY port — no execution logic. The hash-set dedup belongs in the execution layer.

func NewRecordQueryUnorderedPrimaryKeyDistinctPlan

func NewRecordQueryUnorderedPrimaryKeyDistinctPlan(inner RecordQueryPlan) *RecordQueryUnorderedPrimaryKeyDistinctPlan

NewRecordQueryUnorderedPrimaryKeyDistinctPlan constructs a PK-based distinct plan over the given inner plan.

func (*RecordQueryUnorderedPrimaryKeyDistinctPlan) EqualsWithoutChildren

func (p *RecordQueryUnorderedPrimaryKeyDistinctPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren — PK-distinct plans have no node-specific data beyond the concrete type. Mirrors Java where equalsWithoutChildren only checks `getClass() == otherExpression.getClass()`.

func (*RecordQueryUnorderedPrimaryKeyDistinctPlan) Explain

Explain renders UnorderedPrimaryKeyDistinct(inner).

func (*RecordQueryUnorderedPrimaryKeyDistinctPlan) GetChildren

GetChildren returns the inner plan as the only child.

func (*RecordQueryUnorderedPrimaryKeyDistinctPlan) GetInner

GetInner returns the wrapped inner plan.

func (*RecordQueryUnorderedPrimaryKeyDistinctPlan) GetResultType

GetResultType returns the inner plan's result type — PK-distinct doesn't reshape rows.

func (*RecordQueryUnorderedPrimaryKeyDistinctPlan) HashCodeWithoutChildren

func (p *RecordQueryUnorderedPrimaryKeyDistinctPlan) HashCodeWithoutChildren() uint64

HashCodeWithoutChildren is a constant for the type discriminator. Mirrors Java's BASE_HASH("Record-Query-Unordered-Primary-Key-Distinct-Plan").

func (*RecordQueryUnorderedPrimaryKeyDistinctPlan) IsReverse

IsReverse delegates to the inner plan.

type RecordQueryUnorderedUnionPlan

type RecordQueryUnorderedUnionPlan struct {
	// contains filtered or unexported fields
}

RecordQueryUnorderedUnionPlan emits the rows of all input plans concatenated without any ordering guarantee. Mirrors Java's RecordQueryUnorderedUnionPlan.

Distinct from RecordQueryUnionPlan which does merge-sorted output. This plan simply concatenates children in implementation order.

func NewRecordQueryUnorderedUnionPlan

func NewRecordQueryUnorderedUnionPlan(inners []RecordQueryPlan) *RecordQueryUnorderedUnionPlan

func (*RecordQueryUnorderedUnionPlan) EqualsWithoutChildren

func (p *RecordQueryUnorderedUnionPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

func (*RecordQueryUnorderedUnionPlan) Explain

func (*RecordQueryUnorderedUnionPlan) GetChildren

func (*RecordQueryUnorderedUnionPlan) GetInners

func (*RecordQueryUnorderedUnionPlan) GetResultType

func (p *RecordQueryUnorderedUnionPlan) GetResultType() values.Type

func (*RecordQueryUnorderedUnionPlan) HashCodeWithoutChildren

func (p *RecordQueryUnorderedUnionPlan) HashCodeWithoutChildren() uint64

type RecordQueryUpdatePlan

type RecordQueryUpdatePlan struct {
	// contains filtered or unexported fields
}

RecordQueryUpdatePlan is the physical UPDATE plan: applies a list of per-row transforms to records emitted by an inner plan. Mirrors a simplified subset of Java's `RecordQueryUpdatePlan`.

The transforms list is the same `expressions.UpdateTransform` shape used by the logical UpdateExpression — Java carries them through to the physical plan unchanged.

Result type: same as inner.

func NewRecordQueryUpdatePlan

func NewRecordQueryUpdatePlan(inner RecordQueryPlan, targetRecordType string, transforms []expressions.UpdateTransform) *RecordQueryUpdatePlan

NewRecordQueryUpdatePlan constructs the UPDATE plan.

func (*RecordQueryUpdatePlan) EqualsWithoutChildren

func (p *RecordQueryUpdatePlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren compares targetRecordType + transform count. (Per-transform structural comparison is gated on a UpdateTransform equality method which the seed doesn't expose; count match is the best the seed can do without reaching into the transform shape.)

func (*RecordQueryUpdatePlan) Explain

func (p *RecordQueryUpdatePlan) Explain() string

Explain renders Update(target, [N transforms], inner).

func (*RecordQueryUpdatePlan) GetChildren

func (p *RecordQueryUpdatePlan) GetChildren() []RecordQueryPlan

GetChildren returns the inner plan as the only child.

func (*RecordQueryUpdatePlan) GetInner

func (p *RecordQueryUpdatePlan) GetInner() RecordQueryPlan

GetInner returns the source plan.

func (*RecordQueryUpdatePlan) GetResultType

func (p *RecordQueryUpdatePlan) GetResultType() values.Type

GetResultType returns the inner's result type.

func (*RecordQueryUpdatePlan) GetTargetRecordType

func (p *RecordQueryUpdatePlan) GetTargetRecordType() string

GetTargetRecordType returns the destination record-type name.

func (*RecordQueryUpdatePlan) GetTransforms

func (p *RecordQueryUpdatePlan) GetTransforms() []expressions.UpdateTransform

GetTransforms returns the per-row transform list (read-only).

func (*RecordQueryUpdatePlan) HashCodeWithoutChildren

func (p *RecordQueryUpdatePlan) HashCodeWithoutChildren() uint64

HashCodeWithoutChildren mixes class + targetRecordType + transform count.

type RecordQueryValuesPlan

type RecordQueryValuesPlan struct {
	// contains filtered or unexported fields
}

RecordQueryValuesPlan is a leaf physical-plan that produces a single row of constant values — the physical counterpart of LogicalValuesExpression. Mirrors SQL's VALUES (a, b, c) at execution time.

func NewRecordQueryValuesPlan

func NewRecordQueryValuesPlan(columns []values.Value) *RecordQueryValuesPlan

func (*RecordQueryValuesPlan) EqualsWithoutChildren

func (p *RecordQueryValuesPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

func (*RecordQueryValuesPlan) Explain

func (p *RecordQueryValuesPlan) Explain() string

func (*RecordQueryValuesPlan) GetChildren

func (p *RecordQueryValuesPlan) GetChildren() []RecordQueryPlan

func (*RecordQueryValuesPlan) GetColumns

func (p *RecordQueryValuesPlan) GetColumns() []values.Value

func (*RecordQueryValuesPlan) GetResultType

func (p *RecordQueryValuesPlan) GetResultType() values.Type

func (*RecordQueryValuesPlan) HashCodeWithoutChildren

func (p *RecordQueryValuesPlan) HashCodeWithoutChildren() uint64

type RecordQueryVectorIndexPlan

type RecordQueryVectorIndexPlan struct {
	// contains filtered or unexported fields
}

RecordQueryVectorIndexPlan is a K-nearest-neighbor scan over a VECTOR (HNSW) index. It is the physical plan the vector index match candidate emits for a query of the shape

SELECT ... FROM t
WHERE <partition keys = ...>
QUALIFY ROW_NUMBER() OVER (PARTITION BY <keys> ORDER BY <distance>(vec, q)) <= k

Unlike RecordQueryIndexPlan (a BY_VALUE prefix scan), this plan executes a BY_DISTANCE scan: the partition-equality prefix selects the independent HNSW graph, and the graph is traversed for the k nearest neighbors of the query vector. Mirrors the scan Java's VectorIndexScanMatchCandidate lowers to (VectorIndexScanComparisons + a DistanceRankValueComparison).

Leaf node — reads index entries (primaryKey + distance) directly from the HNSW subspace; a fetch step loads the base records.

func NewRecordQueryVectorIndexPlan

func NewRecordQueryVectorIndexPlan(
	indexName string,
	prefixComparisons []*predicates.ComparisonRange,
	queryVector values.Value,
	k values.Value,
	rankType predicates.ComparisonType,
	efSearch *int,
	isReturningVectors *bool,
	recordTypes []string,
	flowedType values.Type,
) *RecordQueryVectorIndexPlan

NewRecordQueryVectorIndexPlan constructs a BY_DISTANCE vector index scan.

func (*RecordQueryVectorIndexPlan) EqualsWithoutChildren

func (p *RecordQueryVectorIndexPlan) EqualsWithoutChildren(other RecordQueryPlan) bool

EqualsWithoutChildren compares index name, prefix comparison shape, and the query-vector / k / ef_search node-info.

func (*RecordQueryVectorIndexPlan) Explain

func (p *RecordQueryVectorIndexPlan) Explain() string

Explain renders a one-line label. The "VectorIndexScan" token is the EXPLAIN-pin anchor used by the conformance tests.

func (*RecordQueryVectorIndexPlan) GetChildren

func (p *RecordQueryVectorIndexPlan) GetChildren() []RecordQueryPlan

GetChildren returns nil — vector scans are leaves.

func (*RecordQueryVectorIndexPlan) GetEfSearch

func (p *RecordQueryVectorIndexPlan) GetEfSearch() *int

GetEfSearch returns the HNSW ef_search knob (nil = default).

func (*RecordQueryVectorIndexPlan) GetIndexName

func (p *RecordQueryVectorIndexPlan) GetIndexName() string

GetIndexName returns the vector index name.

func (*RecordQueryVectorIndexPlan) GetK

GetK returns the top-K Value.

func (*RecordQueryVectorIndexPlan) GetPartitionColumns

func (p *RecordQueryVectorIndexPlan) GetPartitionColumns() []string

GetPartitionColumns returns the partition-key column names in key order.

func (*RecordQueryVectorIndexPlan) GetPrefixComparisons

func (p *RecordQueryVectorIndexPlan) GetPrefixComparisons() []*predicates.ComparisonRange

GetPrefixComparisons returns the partition-key equality ranges.

func (*RecordQueryVectorIndexPlan) GetQueryVector

func (p *RecordQueryVectorIndexPlan) GetQueryVector() values.Value

GetQueryVector returns the search-vector Value.

func (*RecordQueryVectorIndexPlan) GetRankType

GetRankType returns the distance-rank comparison operator (LessThan or LessThanOrEq). Used by the executor to derive the scan limit from k.

func (*RecordQueryVectorIndexPlan) GetRecordTypes

func (p *RecordQueryVectorIndexPlan) GetRecordTypes() []string

GetRecordTypes returns the covered record types.

func (*RecordQueryVectorIndexPlan) GetResultType

func (p *RecordQueryVectorIndexPlan) GetResultType() values.Type

GetResultType returns the flowed row type.

func (*RecordQueryVectorIndexPlan) HashCodeWithoutChildren

func (p *RecordQueryVectorIndexPlan) HashCodeWithoutChildren() uint64

HashCodeWithoutChildren mixes index name + prefix comparison shape.

func (*RecordQueryVectorIndexPlan) IsOrderedStream

func (p *RecordQueryVectorIndexPlan) IsOrderedStream() bool

IsOrderedStream reports whether the scan runs in VBASE distance-ordered mode (emits its re-ranked horizon in distance order, does NOT self-limit to k). See the orderedStream field doc. RFC-156 Phase B.

func (*RecordQueryVectorIndexPlan) IsReturningVectors

func (p *RecordQueryVectorIndexPlan) IsReturningVectors() bool

IsReturningVectors reports whether the scan returns vector payloads.

func (*RecordQueryVectorIndexPlan) WithOrderedStream

WithOrderedStream returns a copy of the plan in distance-ordered (non-self- limiting) mode. The k binding is retained for the SinkLimitIntoVectorScanRule fold and cost estimation, but the executor ignores it in this mode.

func (*RecordQueryVectorIndexPlan) WithPartitionColumns

func (p *RecordQueryVectorIndexPlan) WithPartitionColumns(cols []string) *RecordQueryVectorIndexPlan

WithPartitionColumns returns a copy of the plan carrying the partition-key column names (columnNames[:partitionCount]). Set by the match candidate's ToScanPlan so the planner can certify a partition-column residual as safe.

func (*RecordQueryVectorIndexPlan) WithSelfLimiting

WithSelfLimiting returns a copy of the plan in self-limiting (top-k) mode. SinkLimitIntoVectorScanRule produces this when a Limit(k) sits DIRECTLY above an ordered-stream scan with no intervening residual Filter — restoring the legacy one-shot search(k) path.

type RelativeProbabilityPlanSelector

type RelativeProbabilityPlanSelector struct {
	// contains filtered or unexported fields
}

RelativeProbabilityPlanSelector selects a child plan based on relative probabilities. Mirrors Java's inner RelativeProbabilityPlanSelector class.

func NewRelativeProbabilityPlanSelector

func NewRelativeProbabilityPlanSelector(probabilities []int) *RelativeProbabilityPlanSelector

NewRelativeProbabilityPlanSelector constructs the selector. The sum of probabilities must be 100.

func (*RelativeProbabilityPlanSelector) Equals

Equals compares probability lists.

func (*RelativeProbabilityPlanSelector) GetProbabilities

func (s *RelativeProbabilityPlanSelector) GetProbabilities() []int

GetProbabilities returns the probability list.

func (*RelativeProbabilityPlanSelector) SelectPlan

SelectPlan picks a plan index based on the probabilities. (Structural port only; the random-weighted selection logic belongs in the execution layer.)

func (*RelativeProbabilityPlanSelector) String

String renders the probability list.

type ScoreForRank

type ScoreForRank struct {
	BindingName  string
	FunctionName string
	IndexName    string
	Comparisons  []string // typeless comparison strings
}

ScoreForRank is a single conversion of a rank to a score to be bound to some name. Mirrors Java's RecordQueryScoreForRankPlan.ScoreForRank inner class.

Fields:

  • BindingName: the parameter name the converted score is bound to.
  • FunctionName: the aggregate function name (e.g. "rank").
  • IndexName: the index the rank function operates over.
  • Comparisons: human-readable comparison descriptions (structure only — no execution logic in this port).

func (*ScoreForRank) CallString

func (s *ScoreForRank) CallString() string

CallString renders "indexName.functionName(comp1, comp2)".

func (*ScoreForRank) String

func (s *ScoreForRank) String() string

String renders "bindingName = indexName.functionName(comp1, comp2)".

type SortKey

type SortKey struct {
	Field      string
	Desc       bool
	NullsFirst bool
	ValueExpr  values.Value // when non-nil, evaluate per-row instead of field lookup
}

SortKey is a column + direction for in-memory sorting.

type TextScan

type TextScan struct {
	// IndexName is the name of the text index being scanned.
	IndexName string
	// GroupingComparisons is a human-readable description of the
	// grouping-key prefix comparisons (may be empty).
	GroupingComparisons string
	// TextComparison is a human-readable description of the text
	// comparison (e.g. "TEXT_CONTAINS_ALL 'hello world'").
	TextComparison string
	// SuffixComparisons is a human-readable description of the suffix
	// comparisons (may be empty).
	SuffixComparisons string
}

TextScan encapsulates the information necessary to scan a text-based index. Mirrors Java's `com.apple.foundationdb.record.query.plan.TextScan`.

This is a STRUCTURE-ONLY port — no execution logic. The fields carry enough information for plan equality, hashing, and explain rendering.

type TranslateValueFunction

type TranslateValueFunction func(
	value values.Value,
	sourceAlias values.CorrelationIdentifier,
	targetAlias values.CorrelationIdentifier,
) (values.Value, bool)

TranslateValueFunction translates a Value from the domain of a fetched full record to the domain of the partial record (index entry) that feeds the fetch. Used by RecordQueryFetchFromPartialRecordPlan to enable push-through rules (pushing filters, maps, set operations below the fetch).

Mirrors Java's `TranslateValueFunction` functional interface.

type TupleSource

type TupleSource int

TupleSource identifies which part of an IndexEntry to extract a field from.

const (
	TupleSourceKey   TupleSource = iota // Extract from index key tuple
	TupleSourceValue                    // Extract from index value tuple
)

Jump to

Keyboard shortcuts

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