package
25.1.0+incompatible
Repository: https://github.com/cockroachdb/cockroach.git
Documentation: pkg.go.dev
# README
The opt
package defines common high-level interfaces and classes that multiple
sub-packages share. None of these definitions depend on any sub-packages, so all
sub-packages can therefore depend on opt
without causing cyclical dependencies
(which Go does not allow).
# Packages
Package bench houses benchmarks for the SQL optimizer.
Package cat contains interfaces that are used by the query optimizer to avoid including specifics of sqlbase structures in the opt code.
Package exec contains execution-related utilities.
Package memo exposes logic for `Memo`, the central data structure for `opt`.
Package norm implements normalization for queries.
Package ordering contains operator-specific logic related to orderings - whether
ops can provide Required orderings, what orderings do they need to require from
their children, etc.
Package xform contains logic for transforming SQL queries.
# Functions
AggregateIgnoresDuplicates returns true if the output of the given aggregate operator does not change when duplicate rows are added to the input.
AggregateIgnoresNulls returns true if the given aggregate operator ignores rows where its first argument evaluates to NULL.
AggregateIsNeverNull returns true if the given aggregate operator never returns NULL, even if the input is empty, or one more more inputs are NULL.
AggregateIsNeverNullOnNonNullInput returns true if the given aggregate operator never returns NULL when the input set contains at least one non-NULL value.
AggregateIsNullOnEmpty returns true if the given aggregate operator returns NULL when the input set contains no values.
AggregatesCanMerge returns true if the given inner and outer operators can be replaced with a single equivalent operator, assuming the outer operator is aggregating on the inner and that both operators are unordered.
BoolOperatorRequiresNotNullArgs returns true if the operator can never evaluate to true if one of its children is NULL.
CommuteEqualityOrInequalityOp returns the commuted version of the given operator, e.g.
DepByID is used with AddDependency when the data source was looked up by ID.
DepByName is used with AddDependency when the data source was looked up using a data source name.
JoinTypeToUseCounter returns the JoinTypeXyzUseCounter for the given join operator.
MakeColSet returns a set initialized with the given values.
MakeOrderingColumn initializes an ordering column with a ColumnID and a flag indicating whether the direction is descending.
MaybeInjectOptimizerTestingPanic has a small chance of creating a panic.
NewTableAnnID allocates a unique annotation identifier that is used to associate arbitrary data with table metadata.
ScalarOperatorTransmitsNulls returns true if the given scalar operator always returns NULL when at least one of its inputs is NULL.
TranslateColSet is used to translate a ColSet from one set of column IDs to an equivalent set.
TranslateColSetStrict is a version of TranslateColSet which requires that all columns in the input set appear in the from list.
# Constants
DefaultJoinOrderLimit denotes the default limit on the number of joins to reorder.
Enumeration of all manual rule names.
MaxReorderJoinsLimit is the maximum number of joins which can be reordered.
NumManualRules tracks the number of manually-defined rules.
Enumeration of all manual rule names.
SaveTablesDatabase is the name of the database where tables created by the saveTableNode are stored.
Enumeration of all manual rule names.
Enumeration of all manual rule names.
# Variables
AggregateOpReverseMap maps from an optimizer operator type to the name of an aggregation function.
BinaryOpReverseMap maps from an optimizer operator type to a semantic tree binary operator type.
ComparisonOpMap maps from a semantic tree comparison operator type to an optimizer operator type.
ComparisonOpReverseMap maps from an optimizer operator type to a semantic tree comparison operator type.
NegateOpMap maps from a comparison operator type to its negated operator type, as if the Not operator was applied to it.
NotNullAnnID is the annotation ID for table not null columns.
OpTelemetryCounters stores telemetry counters for operators marked with the "Telemetry" tag.
UnaryOpReverseMap maps from an optimizer operator type to a semantic tree unary operator type.
WindowOpReverseMap maps from an optimizer operator type to the name of a window function.
# Structs
AliasedColumn specifies the label and id of a column.
ColSet efficiently stores an unordered set of column ids.
ColumnMeta stores information about one of the columns stored in the metadata.
LiteralRows is a container for literal values (i.e.
Locking represents the row-level locking properties of a relational operator.
MDDepName stores either the unresolved DataSourceName or the StableID from the query that was used to resolve a data source.
Metadata assigns unique ids to the columns, tables, and other metadata used for global identification within the scope of a particular query.
SchemaDep contains information about a dependency from a schema object (typically view and function) to a datasource.
TableMeta stores information about one of the tables stored in the metadata.
# Interfaces
Expr is a node in an expression tree.
MutableExpr is implemented by expressions that allow their children to be updated.
OpaqueMetadata is an object stored in OpaqueRelExpr and passed through to the exec factory.
ScalarExpr is a scalar expression, which is an expression that returns a primitive-typed value like boolean or string rather than rows and columns.
# Type aliases
ColList is a list of column IDs.
ColMap provides a 1:1 mapping from one column id to another.
ColumnID uniquely identifies the usage of a column within the scope of a query.
Operator describes the type of operation that a memo expression performs.
OptionalColList is a list of column IDs where some of the IDs can be unset.
Ordering defines the order of rows provided or required by an operator.
OrderingColumn is the ColumnID for a column that is part of an ordering, except that it can be negated to indicate a descending ordering on that column.
RuleName enumerates the names of all the optimizer rules.
ScalarRank is the type of the sort order given to every scalar expression.
SchemaDeps contains information about the dependencies of objects in a schema, like a view or function.
SchemaID uniquely identifies the usage of a schema within the scope of a query.
SchemaTypeDeps contains a set of the IDs of types that this object depends on.
SequenceID uniquely identifies the usage of a sequence within the scope of a query.
TableAnnID uniquely identifies an annotation on an instance of table metadata.
TableID uniquely identifies the usage of a table within the scope of a query.
UniqueID should be used to disambiguate multiple uses of an expression within the scope of a query.
WithID uniquely identifies a With expression within the scope of a query.