cockroach: github.com/cockroachdb/cockroach/pkg/sql/opt/exec Index | Files | Directories

package exec

import "github.com/cockroachdb/cockroach/pkg/sql/opt/exec"

Index

Package Files

factory.go

Constants

const InsertFastPathMaxRows = 10000

InsertFastPathMaxRows is the maximum number of rows for which we can use the insert fast path.

type AggInfo Uses

type AggInfo struct {
    FuncName   string
    Distinct   bool
    ResultType *types.T
    ArgCols    []NodeColumnOrdinal

    // ConstArgs is the list of any constant arguments to the aggregate,
    // for instance, the separator in string_agg.
    ConstArgs []tree.Datum

    // Filter is the index of the column, if any, which should be used as the
    // FILTER condition for the aggregate. If there is no filter, Filter is -1.
    Filter NodeColumnOrdinal
}

AggInfo represents an aggregation (see ConstructGroupBy).

type ApplyJoinPlanRightSideFn Uses

type ApplyJoinPlanRightSideFn func(ef Factory, leftRow tree.Datums) (Plan, error)

ApplyJoinPlanRightSideFn creates a plan for an iteration of ApplyJoin, given a row produced from the left side. The plan is guaranteed to produce the rightColumns passed to ConstructApplyJoin (in order).

type BuildPlanForExplainFn Uses

type BuildPlanForExplainFn func(ef ExplainFactory) (Plan, error)

BuildPlanForExplainFn builds an execution plan against the given ExplainFactory.

type Cascade Uses

type Cascade struct {
    // FKName is the name of the foreign key constraint.
    FKName string

    // Buffer is the Node returned by ConstructBuffer which stores the input to
    // the mutation.
    Buffer Node

    // PlanFn builds the cascade query and creates the plan for it.
    // Note that the generated Plan can in turn contain more cascades (as well as
    // checks, which should run after all cascades are executed).
    //
    // The bufferRef is a reference that can be used with ConstructWithBuffer to
    // read the mutation input. It is conceptually the same as the Buffer field;
    // however, we allow the execution engine to provide a different copy or
    // implementation of the node (e.g. to facilitate early cleanup of the
    // original plan).
    //
    // This method does not mutate any captured state; it is ok to call PlanFn
    // methods concurrently (provided that they don't use a single non-thread-safe
    // execFactory).
    PlanFn func(
        ctx context.Context,
        semaCtx *tree.SemaContext,
        evalCtx *tree.EvalContext,
        execFactory Factory,
        bufferRef Node,
        numBufferedRows int,
        allowAutoCommit bool,
    ) (Plan, error)
}

Cascade describes a cascading query. The query uses a node created by ConstructBuffer as an input; it should only be triggered if this buffer is not empty.

type CheckOrdinalSet Uses

type CheckOrdinalSet = util.FastIntSet

CheckOrdinalSet contains the ordinal positions of a set of check constraints taken from the opt.Table.Check collection.

type EstimatedStats Uses

type EstimatedStats struct {
    // TableStatsAvailable is true if all the tables involved by this operator
    // (directly or indirectly) had table statistics.
    TableStatsAvailable bool
    // RowCount is the estimated number of rows produced by the operator.
    RowCount float64
    // Cost is the estimated cost of the operator. This cost includes the costs of
    // the child operators.
    Cost float64
}

EstimatedStats contains estimated statistics about a given operator.

type ExplainAnnotationID Uses

type ExplainAnnotationID int

ExplainAnnotationID identifies the type of a node annotation.

const (
    // EstimatedStatsID is an annotation with a *EstimatedStats value.
    EstimatedStatsID ExplainAnnotationID = iota
)

type ExplainEnvData Uses

type ExplainEnvData struct {
    ShowEnv   bool
    Tables    []tree.TableName
    Sequences []tree.TableName
    Views     []tree.TableName
}

ExplainEnvData represents the data that's going to be displayed in EXPLAIN (env).

type ExplainFactory Uses

type ExplainFactory interface {
    Factory

    // AnnotateNode annotates a constructed Node with extra information.
    AnnotateNode(n Node, id ExplainAnnotationID, value interface{})
}

ExplainFactory is an extension of Factory used when constructing a plan that can be explained. It allows annotation of nodes with extra information.

type InsertFastPathFKCheck Uses

type InsertFastPathFKCheck struct {
    ReferencedTable cat.Table
    ReferencedIndex cat.Index

    // InsertCols contains the FK columns from the origin table, in the order of
    // the ReferencedIndex columns. For each, the value in the array indicates the
    // index of the column in the input table.
    InsertCols []TableColumnOrdinal

    MatchMethod tree.CompositeKeyMatchMethod

    // MkErr is called when a violation is detected (i.e. the index has no entries
    // for a given inserted row). The values passed correspond to InsertCols
    // above.
    MkErr MkErrFn
}

InsertFastPathFKCheck contains information about a foreign key check to be performed by the insert fast-path (see ConstructInsertFastPath). It identifies the index into which we can perform the lookup.

type KVOption Uses

type KVOption struct {
    Key string
    // If there is no value, Value is DNull.
    Value tree.TypedExpr
}

KVOption represents information about a statement option (see tree.KVOptions).

type MkErrFn Uses

type MkErrFn func(tree.Datums) error

MkErrFn is a function that generates an error which includes values from a relevant row.

type Node Uses

type Node interface{}

Node represents a node in the execution tree (currently maps to sql.planNode).

type NodeColumnOrdinal Uses

type NodeColumnOrdinal int32

NodeColumnOrdinal is the 0-based ordinal index of a column produced by a Node. It is used when referring to a column in an input to an operator.

type NodeColumnOrdinalSet Uses

type NodeColumnOrdinalSet = util.FastIntSet

NodeColumnOrdinalSet contains a set of NodeColumnOrdinal values.

type OutputOrdering Uses

type OutputOrdering colinfo.ColumnOrdering

OutputOrdering indicates the required output ordering on a Node that is being created. It refers to the output columns of the node by ordinal.

This ordering is used for distributed execution planning, to know how to merge results from different nodes. For example, scanning a table can be executed as multiple hosts scanning different pieces of the table. When the results from the nodes get merged, we they are merged according to the output ordering.

The node must be able to support this output ordering given its other configuration parameters.

type Plan Uses

type Plan interface{}

Plan represents the plan for a query (currently maps to sql.planTop). For simple queries, the plan is associated with a single Node tree. For queries containing subqueries, the plan is associated with multiple Node trees (see ConstructPlan).

type RecursiveCTEIterationFn Uses

type RecursiveCTEIterationFn func(ef Factory, bufferRef Node) (Plan, error)

RecursiveCTEIterationFn creates a plan for an iteration of WITH RECURSIVE, given the result of the last iteration (as a node created by ConstructBuffer).

type ScanParams Uses

type ScanParams struct {
    // Only columns in this set are scanned and produced.
    NeededCols TableColumnOrdinalSet

    // At most one of IndexConstraint or InvertedConstraint is non-nil, depending
    // on the index type.
    IndexConstraint    *constraint.Constraint
    InvertedConstraint invertedexpr.InvertedSpans

    // If non-zero, the scan returns this many rows.
    HardLimit int64

    // If non-zero, the scan may still be required to return up to all its rows
    // (or up to the HardLimit if it is set, but can be optimized under the
    // assumption that only SoftLimit rows will be needed.
    SoftLimit int64

    Reverse bool

    // If true, the scan will scan all spans in parallel. It should only be set to
    // true if there is a known upper bound on the number of rows that will be
    // scanned. It should not be set if there is a hard or soft limit.
    Parallelize bool

    Locking *tree.LockingItem

    EstimatedRowCount float64
}

ScanParams contains all the parameters for a table scan.

type Subquery Uses

type Subquery struct {
    // ExprNode is a reference to a AST node that can be used for printing the SQL
    // of the subquery (for EXPLAIN).
    ExprNode tree.NodeFormatter
    Mode     SubqueryMode
    // Root is the root Node of the plan for this subquery. This Node returns
    // results as required for the specific Type.
    Root Node
}

Subquery encapsulates information about a subquery that is part of a plan.

type SubqueryMode Uses

type SubqueryMode int

SubqueryMode indicates how the results of the subquery are to be processed.

const (
    // SubqueryExists - the value of the subquery is a boolean: true if the
    // subquery returns any rows, false otherwise.
    SubqueryExists SubqueryMode = iota
    // SubqueryOneRow - the subquery expects at most one row; the result is that
    // row (as a single value or a tuple), or NULL if there were no rows.
    SubqueryOneRow
    // SubqueryAnyRows - the subquery is an argument to ANY. Any number of rows
    // expected; the result is a sorted, distinct tuple of rows (i.e. it has been
    // normalized). As a special case, if there is only one column selected, the
    // result is a tuple of the selected values (instead of a tuple of 1-tuples).
    SubqueryAnyRows
    // SubqueryAllRows - the subquery is an argument to ARRAY. The result is a
    // tuple of rows.
    SubqueryAllRows
)

type TableColumnOrdinal Uses

type TableColumnOrdinal int32

TableColumnOrdinal is the 0-based ordinal index of a cat.Table column. It is used when operations involve a table directly (e.g. scans, index/lookup joins, mutations).

type TableColumnOrdinalSet Uses

type TableColumnOrdinalSet = util.FastIntSet

TableColumnOrdinalSet contains a set of TableColumnOrdinal values.

type WindowInfo Uses

type WindowInfo struct {
    // Cols is the set of columns that are returned from the windowing operator.
    Cols colinfo.ResultColumns

    // Exprs is the list of window function expressions.
    Exprs []*tree.FuncExpr

    // OutputIdxs are the indexes that the various window functions being computed
    // should put their output in.
    OutputIdxs []int

    // ArgIdxs is the list of column ordinals each function takes as arguments,
    // in the same order as Exprs.
    ArgIdxs [][]NodeColumnOrdinal

    // FilterIdxs is the list of column indices to use as filters.
    FilterIdxs []int

    // Partition is the set of input columns to partition on.
    Partition []NodeColumnOrdinal

    // Ordering is the set of input columns to order on.
    Ordering colinfo.ColumnOrdering
}

WindowInfo represents the information about a window function that must be passed through to the execution engine.

Directories

PathSynopsis
execbuilder
explain

Package exec imports 8 packages (graph) and is imported by 7 packages. Updated 2020-09-23. Refresh now. Tools for package owners.