analyzer

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDomainConstraints added in v0.14.0

func AddDomainConstraints(ctx *sql.Context, a *analyzer.Analyzer, node sql.Node, scope *plan.Scope, selector analyzer.RuleSelector, qFlags *sql.QueryFlags) (sql.Node, transform.TreeIdentity, error)

AddDomainConstraints adds domain type's default value and check constraints to the destination table schema and InsertNode/Update node's checks.

func AddDomainConstraintsToCasts added in v0.16.0

func AddDomainConstraintsToCasts(ctx *sql.Context, a *analyzer.Analyzer, node sql.Node, scope *plan.Scope, selector analyzer.RuleSelector, qFlags *sql.QueryFlags) (sql.Node, transform.TreeIdentity, error)

AddDomainConstraintsToCasts adds domain type's constraints to cast expressions.

func AddImplicitPrefixLengths added in v0.13.0

func AddImplicitPrefixLengths(_ *sql.Context, _ *analyzer.Analyzer, node sql.Node, _ *plan.Scope, _ analyzer.RuleSelector, _ *sql.QueryFlags) (sql.Node, transform.TreeIdentity, error)

AddImplicitPrefixLengths searches the |node| tree for any nodes creating an index, and plugs in a default index prefix length for any TEXT columns in those new indexes. This rule is intended to be used for Postgres compatibility, since Postgres does not require specifying prefix lengths for TEXT columns.

func AssignInsertCasts

func AssignInsertCasts(ctx *sql.Context, a *analyzer.Analyzer, node sql.Node, scope *plan.Scope, selector analyzer.RuleSelector, qFlags *sql.QueryFlags) (sql.Node, transform.TreeIdentity, error)

AssignInsertCasts adds the appropriate assign casts for insertions.

func AssignUpdateCasts

func AssignUpdateCasts(ctx *sql.Context, a *analyzer.Analyzer, node sql.Node, scope *plan.Scope, selector analyzer.RuleSelector, qFlags *sql.QueryFlags) (sql.Node, transform.TreeIdentity, error)

AssignUpdateCasts adds the appropriate assign casts for updates.

func Init

func Init()

Init adds additional rules to the analyzer to handle Doltgres-specific functionality.

func InsertContextRootFinalizer

func InsertContextRootFinalizer(ctx *sql.Context, a *analyzer.Analyzer, node sql.Node, scope *plan.Scope, selector analyzer.RuleSelector, qFlags *sql.QueryFlags) (sql.Node, transform.TreeIdentity, error)

InsertContextRootFinalizer inserts a ContextRootFinalizer node right before the transaction commits, yet after all other nodes have finished. This ensures that the ContextRootFinalizer does not overwrite any changes from its children.

func OptimizeFunctions added in v0.16.0

func OptimizeFunctions(ctx *sql.Context, a *analyzer.Analyzer, node sql.Node, scope *plan.Scope, selector analyzer.RuleSelector, qFlags *sql.QueryFlags) (sql.Node, transform.TreeIdentity, error)

OptimizeFunctions replaces all functions that fit specific criteria with their optimized variants.

func ReplaceArithmeticExpressions added in v0.16.0

func ReplaceArithmeticExpressions(ctx *sql.Context, a *analyzer.Analyzer, node sql.Node, scope *plan.Scope, selector analyzer.RuleSelector, qFlags *sql.QueryFlags) (sql.Node, transform.TreeIdentity, error)

ReplaceArithmeticExpressions replaces arithmetic expressions in the tree with the equivalent binary operators. This is a problem in certain nodes that do arithmetic, such as TopN, but all nodes are covered.

func ReplaceIndexedTables added in v0.12.0

func ReplaceIndexedTables(ctx *sql.Context, a *analyzer.Analyzer, node sql.Node, scope *plan.Scope, selector analyzer.RuleSelector, qFlags *sql.QueryFlags) (sql.Node, transform.TreeIdentity, error)

ReplaceIndexedTables replaces Dolt tables with Doltgres tables that can properly handle indexed access.

func ReplaceSerial

func ReplaceSerial(ctx *sql.Context, a *analyzer.Analyzer, node sql.Node, scope *plan.Scope, selector analyzer.RuleSelector, qFlags *sql.QueryFlags) (sql.Node, transform.TreeIdentity, error)

ReplaceSerial replaces a CreateTable node containing a SERIAL type with a node that can create sequences alongside the table.

func ResolveType added in v0.14.0

func ResolveType(ctx *sql.Context, a *analyzer.Analyzer, node sql.Node, scope *plan.Scope, selector analyzer.RuleSelector, qFlags *sql.QueryFlags) (sql.Node, transform.TreeIdentity, error)

ResolveType replaces types.ResolvableType to appropriate pgtypes.DoltgresType.

func ResolveTypeForExprs added in v0.16.0

func ResolveTypeForExprs(ctx *sql.Context, a *analyzer.Analyzer, node sql.Node, scope *plan.Scope, selector analyzer.RuleSelector, qFlags *sql.QueryFlags) (sql.Node, transform.TreeIdentity, error)

ResolveTypeForExprs replaces types.ResolvableType to appropriate pgtypes.DoltgresType.

func ResolveTypeForNodes added in v0.16.0

func ResolveTypeForNodes(ctx *sql.Context, a *analyzer.Analyzer, node sql.Node, scope *plan.Scope, selector analyzer.RuleSelector, qFlags *sql.QueryFlags) (sql.Node, transform.TreeIdentity, error)

ResolveTypeForNodes replaces types.ResolvableType to appropriate pgtypes.DoltgresType.

func TypeSanitizer

func TypeSanitizer(ctx *sql.Context, a *analyzer.Analyzer, node sql.Node, scope *plan.Scope, selector analyzer.RuleSelector, qFlags *sql.QueryFlags) (sql.Node, transform.TreeIdentity, error)

TypeSanitizer converts all GMS types into Doltgres types. Some places, such as parameter binding, will always default to GMS types, so by taking care of all conversions here, we can ensure that Doltgres only needs to worry about its own types.

Types

This section is empty.

Jump to

Keyboard shortcuts

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