resolved_ast

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Walk

func Walk(n Node, cb func(Node) error) error

Walk traverse all nodes by depth-first search.

Types

type AbortBatchStmtNode

type AbortBatchStmtNode struct {
	*BaseStatementNode
}

AbortBatchStmtNode this statement: ABORT BATCH;

type ActionOperation

type ActionOperation int
const (
	ActionOperationNoAction ActionOperation = 0
	ActionOperationRestrict ActionOperation = 1
	ActionOperationCascade  ActionOperation = 2
	ActionOperationSetNull  ActionOperation = 3
)

type ActionType

type ActionType int
const (
	ActionTypeInsert ActionType = 0
	ActionTypeUpdate ActionType = 1
	ActionTypeDelete ActionType = 2
)

type AddColumnActionNode

type AddColumnActionNode struct {
	*BaseAlterActionNode
}

AddColumnActionNode ADD COLUMN action for ALTER TABLE statement.

func (*AddColumnActionNode) ColumnDefinition

func (n *AddColumnActionNode) ColumnDefinition() *ColumnDefinitionNode

func (*AddColumnActionNode) IsIfNotExists

func (n *AddColumnActionNode) IsIfNotExists() bool

func (*AddColumnActionNode) SetColumnDefinition

func (n *AddColumnActionNode) SetColumnDefinition(v *ColumnDefinitionNode)

func (*AddColumnActionNode) SetIsIfNotExists

func (n *AddColumnActionNode) SetIsIfNotExists(v bool)

type AddConstraintActionNode

type AddConstraintActionNode struct {
	*BaseAlterActionNode
}

AddConstraintActionNode ADD CONSTRAINT for ALTER TABLE statement.

func (*AddConstraintActionNode) Constraint

func (n *AddConstraintActionNode) Constraint() ConstraintNode

func (*AddConstraintActionNode) IsIfNotExists

func (n *AddConstraintActionNode) IsIfNotExists() bool

func (*AddConstraintActionNode) SetConstraint

func (n *AddConstraintActionNode) SetConstraint(v ConstraintNode)

func (*AddConstraintActionNode) SetIsIfNotExists

func (n *AddConstraintActionNode) SetIsIfNotExists(v bool)

func (*AddConstraintActionNode) SetTable

func (n *AddConstraintActionNode) SetTable(v types.Table)

func (*AddConstraintActionNode) Table

func (n *AddConstraintActionNode) Table() types.Table

type AddToRestricteeListActionNode

type AddToRestricteeListActionNode struct {
	*BaseAlterActionNode
}

AddToRestricteeListActionNode This action for ALTER PRIVILEGE RESTRICTION statement:

ADD [IF NOT EXISTS] <restrictee_list>

<restrictee_list> is a list of users and groups the privilege restrictions

should apply to. Each restrictee is either a string
literal or a parameter.

func (*AddToRestricteeListActionNode) AddRestrictee

func (n *AddToRestricteeListActionNode) AddRestrictee(v ExprNode)

func (*AddToRestricteeListActionNode) IsIfNotExists

func (n *AddToRestricteeListActionNode) IsIfNotExists() bool

func (*AddToRestricteeListActionNode) RestricteeList

func (n *AddToRestricteeListActionNode) RestricteeList() []ExprNode

func (*AddToRestricteeListActionNode) SetIsIfNotExists

func (n *AddToRestricteeListActionNode) SetIsIfNotExists(v bool)

func (*AddToRestricteeListActionNode) SetRestricteeList

func (n *AddToRestricteeListActionNode) SetRestricteeList(v []ExprNode)

type AggregateFunctionCallNode

type AggregateFunctionCallNode struct {
	*BaseNonScalarFunctionCallNode
}

AggregateFunctionCallNode an aggregate function call. The signature always has mode AGGREGATE. This node only ever shows up as the outer function call in a AggregateScanNode.AggregateList.

func (*AggregateFunctionCallNode) AddOrderByItem

func (n *AggregateFunctionCallNode) AddOrderByItem(v *OrderByItemNode)

func (*AggregateFunctionCallNode) FunctionCallInfo

func (n *AggregateFunctionCallNode) FunctionCallInfo() *FunctionCallInfo

FunctionCallInfo this contains optional custom information about a particular function call. Functions may introduce subclasses of this class to add custom information as needed on a per-function basis.

This field is ignorable because for most types of function calls, there is no extra information to consider besides the arguments and other fields from BaseFunctionCallNode. However, for example, the TemplateSQLFunction in zetasql/public/templated_sql_function.h defines the TemplatedSQLFunctionCall subclass which includes the fully-resolved function body in context of the actual concrete types of the arguments provided to the function call.

func (*AggregateFunctionCallNode) HavingModifier

HavingModifier apply HAVING MAX/MIN filtering to the stream of input values.

func (*AggregateFunctionCallNode) Limit

func (*AggregateFunctionCallNode) OrderByItemList

func (n *AggregateFunctionCallNode) OrderByItemList() []*OrderByItemNode

OrderByItemList apply ordering to the stream of input values before calling function.

func (*AggregateFunctionCallNode) SetFunctionCallInfo

func (n *AggregateFunctionCallNode) SetFunctionCallInfo(v *FunctionCallInfo)

func (*AggregateFunctionCallNode) SetHavingModifier

func (n *AggregateFunctionCallNode) SetHavingModifier(v *AggregateHavingModifierNode)

func (*AggregateFunctionCallNode) SetLimit

func (n *AggregateFunctionCallNode) SetLimit(v ExprNode)

func (*AggregateFunctionCallNode) SetOrderByItemList

func (n *AggregateFunctionCallNode) SetOrderByItemList(v []*OrderByItemNode)

type AggregateHavingModifierNode

type AggregateHavingModifierNode struct {
	*BaseArgumentNode
}

AggregateHavingModifierNode this represents a HAVING MAX or HAVING MIN modifier in an aggregate expression. If an aggregate has arguments (x HAVING {MAX/MIN} y), the aggregate will be computed over only the x values in the rows with the maximal/minimal values of y.

<kind> the MAX/MIN kind of this HAVING <having_expr> the HAVING expression (y in the above example)

func (*AggregateHavingModifierNode) HavingExpr

func (n *AggregateHavingModifierNode) HavingExpr() ExprNode

func (*AggregateHavingModifierNode) ModifierKind

func (*AggregateHavingModifierNode) SetHavingExpr

func (n *AggregateHavingModifierNode) SetHavingExpr(v ExprNode)

func (*AggregateHavingModifierNode) SetModifierKind

func (n *AggregateHavingModifierNode) SetModifierKind(v HavingModifierKind)

type AggregateScanNode

type AggregateScanNode struct {
	*BaseAggregateScanNode
}

AggregateScanNode apply aggregation to rows produced from input_scan, and output aggregated rows.

For each item in <grouping_set_list>, output additional rows computing the same <aggregate_list> over the input rows using a particular grouping set. The aggregation input values, including <input_scan>, computed columns in <group_by_list>, and aggregate function arguments in <aggregate_list>, should be computed just once and then reused as aggregation input for each grouping set. (This ensures that ROLLUP rows have correct totals, even with non-stable functions in the input.) For each grouping set, the <group_by_list> elements not included in the <group_by_column_list> are replaced with NULL.

<rollup_column_list> is the original list of columns from GROUP BY ROLLUP(...), if there was a ROLLUP clause, and is used only for rebuilding equivalent SQL for the resolved AST. Engines should refer to <grouping_set_list> rather than <rollup_column_list>.

func (*AggregateScanNode) AddGroupingSet

func (n *AggregateScanNode) AddGroupingSet(v *GroupingSetNode)

func (*AggregateScanNode) AddRollupColumn

func (n *AggregateScanNode) AddRollupColumn(v *ColumnRefNode)

func (*AggregateScanNode) GroupingSetList

func (n *AggregateScanNode) GroupingSetList() []*GroupingSetNode

func (*AggregateScanNode) RollupColumnList

func (n *AggregateScanNode) RollupColumnList() []*ColumnRefNode

func (*AggregateScanNode) SetGroupingSetList

func (n *AggregateScanNode) SetGroupingSetList(v []*GroupingSetNode)

func (*AggregateScanNode) SetRollupColumnList

func (n *AggregateScanNode) SetRollupColumnList(v []*ColumnRefNode)

type AlterActionNode

type AlterActionNode interface {
	ArgumentNode
}

AlterActionNode a common node for all actions in statement ALTER <object>.

type AlterAllRowAccessPoliciesStmtNode

type AlterAllRowAccessPoliciesStmtNode struct {
	*AlterObjectStmtNode
}

AlterAllRowAccessPoliciesStmtNode this statement:

ALTER ALL ROW ACCESS POLICIES ON <name_path> <alter_action_list>

<name_path> is a vector giving the identifier path in the table name. <alter_action_list> is a vector of actions to be done to the object. It

must have exactly one REVOKE FROM action with either
a non-empty grantee list or 'all'.

<table_scan> is a TableScan for the target table, which is used during

resolving and validation. Consumers can use either the table
object inside it or base <name_path> to reference the table.

func (*AlterAllRowAccessPoliciesStmtNode) SetTableScan

func (*AlterAllRowAccessPoliciesStmtNode) TableScan

type AlterColumnActionNode

type AlterColumnActionNode interface {
	AlterActionNode
	IsIfExists() bool
	SetIsIfExists(bool)
	Column() string
	SetColumn(string)
}

AlterColumnActionNode a abstract node for all ALTER COLUMN actions in the ALTER TABLE statement:

ALTER TABLE <table_name> ALTER COLUMN [IF EXISTS] <column>

<is_if_exists> silently ignores the "column does not exist" error. <column> is the name of the column.

type AlterColumnDropDefaultActionNode

type AlterColumnDropDefaultActionNode struct {
	*BaseAlterColumnActionNode
}

AlterColumnDropDefaultAction this ALTER action:

ALTER COLUMN [IF EXISTS] <column> DROP DEFAULT

Removes the DEFAULT constraint from the given column.

type AlterColumnDropNotNullActionNode

type AlterColumnDropNotNullActionNode struct {
	*BaseAlterColumnActionNode
}

AlterColumnDropNotNullActionNode This ALTER action:

ALTER COLUMN [IF EXISTS] <column> DROP NOT NULL

Removes the NOT NULL constraint from the given column.

type AlterColumnOptionsActionNode

type AlterColumnOptionsActionNode struct {
	*BaseAlterColumnActionNode
}

AlterColumnOptionsActionNode

func (*AlterColumnOptionsActionNode) AddOption

func (n *AlterColumnOptionsActionNode) AddOption(v *OptionNode)

func (*AlterColumnOptionsActionNode) OptionList

func (n *AlterColumnOptionsActionNode) OptionList() []*OptionNode

func (*AlterColumnOptionsActionNode) SetOptionList

func (n *AlterColumnOptionsActionNode) SetOptionList(v []*OptionNode)

type AlterColumnSetDataTypeActionNode

type AlterColumnSetDataTypeActionNode struct {
	*BaseAlterColumnActionNode
}

AlterColumnSetDataTypeActionNode ALTER COLUMN <column> SET DATA TYPE action for ALTER TABLE statement. It supports updating the data type of the column as well as updating type parameters and collation specifications of the column (and on struct fields and array elements).

func (*AlterColumnSetDataTypeActionNode) SetUpdatedAnnotations

func (n *AlterColumnSetDataTypeActionNode) SetUpdatedAnnotations(v *ColumnAnnotationsNode)

func (*AlterColumnSetDataTypeActionNode) SetUpdatedType

func (n *AlterColumnSetDataTypeActionNode) SetUpdatedType(v types.Type)

func (*AlterColumnSetDataTypeActionNode) SetUpdatedTypeParameters

func (n *AlterColumnSetDataTypeActionNode) SetUpdatedTypeParameters(v *types.TypeParameters)

func (*AlterColumnSetDataTypeActionNode) UpdatedAnnotations

UpdatedAnnotations the new annotations for the column including the new collation specifications. Changing options using SET DATA TYPE action is not allowed.

func (*AlterColumnSetDataTypeActionNode) UpdatedType

func (n *AlterColumnSetDataTypeActionNode) UpdatedType() types.Type

UpdatedType the new type for the column.

func (*AlterColumnSetDataTypeActionNode) UpdatedTypeParameters

func (n *AlterColumnSetDataTypeActionNode) UpdatedTypeParameters() *types.TypeParameters

UpdatedTypeParameters the new type parameters for the column, if the new type has parameters. Note that unlike with CREATE TABLE, the child_list is populated for ARRAY and STRUCT types. TODO Use updated_annotations to pass type parameters.

type AlterColumnSetDefaultActionNode

type AlterColumnSetDefaultActionNode struct {
	*BaseAlterColumnActionNode
}

AlterColumnSetDefaultActionNode alter column set default action:

ALTER COLUMN [IF EXISTS] <column> SET DEFAULT <default_value>

<default_value> sets the new default value expression. It only impacts future inserted rows, and has no impact on existing rows with the current default value. This is a metadata only operation.

Resolver validates that <default_value> expression can be coerced to the column type when <column> exists. If <column> is not found and <is_if_exists> is true, Resolver skips type match check.

func (*AlterColumnSetDefaultActionNode) DefaultValue

func (*AlterColumnSetDefaultActionNode) SetDefaultValue

type AlterDatabaseStmtNode

type AlterDatabaseStmtNode struct {
	*AlterObjectStmtNode
}

AlterDatabaseStmtNode this statement:

ALTER DATABASE [IF EXISTS] <name_path> <alter_action_list>

This statement could be used to change the database level options.

type AlterEntityStmtNode

type AlterEntityStmtNode struct {
	*AlterObjectStmtNode
}

AlterEntityStmtNode this statement: ALTER <entity_type> [IF EXISTS] <path_expression> <generic_alter_action>, ...

<entity_type> engine-specific entity type to be altered.

func (*AlterEntityStmtNode) EntityType

func (n *AlterEntityStmtNode) EntityType() string

func (*AlterEntityStmtNode) SetEntityType

func (n *AlterEntityStmtNode) SetEntityType(v string)

type AlterMaterializedViewStmtNode

type AlterMaterializedViewStmtNode struct {
	*AlterObjectStmtNode
}

AlterMaterializedViewStmtNode this statement: ALTER MATERIALIZED VIEW [IF EXISTS] <name_path> <alter_action_list>.

type AlterObjectStmtNode

type AlterObjectStmtNode struct {
	*BaseStatementNode
}

AlterObjectStmtNode common node for statements:

ALTER <object> [IF EXISTS] <name_path> <alter_action_list>

<name_path> is a vector giving the identifier path in the table <name>. It

is optional if
FEATURE_ALLOW_MISSING_PATH_EXPRESSION_IN_ALTER_DDL is enabled.

<alter_action_list> is a vector of actions to be done to the object. <is_if_exists> silently ignores the "name_path does not exist" error.

func (*AlterObjectStmtNode) AddAlterAction

func (n *AlterObjectStmtNode) AddAlterAction(v AlterActionNode)

func (*AlterObjectStmtNode) AddNamePath

func (n *AlterObjectStmtNode) AddNamePath(v string)

func (*AlterObjectStmtNode) AlterActionList

func (n *AlterObjectStmtNode) AlterActionList() []AlterActionNode

func (*AlterObjectStmtNode) IsIfExists

func (n *AlterObjectStmtNode) IsIfExists() bool

func (*AlterObjectStmtNode) NamePath

func (n *AlterObjectStmtNode) NamePath() []string

func (*AlterObjectStmtNode) SetAlterActionList

func (n *AlterObjectStmtNode) SetAlterActionList(v []AlterActionNode)

func (*AlterObjectStmtNode) SetIsIfExists

func (n *AlterObjectStmtNode) SetIsIfExists(v bool)

func (*AlterObjectStmtNode) SetNamePath

func (n *AlterObjectStmtNode) SetNamePath(v []string)

type AlterPrivilegeRestrictionStmtNode

type AlterPrivilegeRestrictionStmtNode struct {
	*AlterObjectStmtNode
}

AlterPrivilegeRestrictionStmtNode this statement:

ALTER PRIVILEGE RESTRICTION [IF EXISTS]
ON <column_privilege_list> ON <object_type> <name_path>
<alter_action_list>

<column_privilege_list> is the name of the column privileges on which

the restrictions have been applied.

<object_type> is a string identifier, which is currently either TABLE or

VIEW, which tells the engine how to look up the name.

func (*AlterPrivilegeRestrictionStmtNode) AddColumnPrivilege

func (n *AlterPrivilegeRestrictionStmtNode) AddColumnPrivilege(v *PrivilegeNode)

func (*AlterPrivilegeRestrictionStmtNode) ColumnPrivilegeList

func (n *AlterPrivilegeRestrictionStmtNode) ColumnPrivilegeList() []*PrivilegeNode

func (*AlterPrivilegeRestrictionStmtNode) ObjectType

func (n *AlterPrivilegeRestrictionStmtNode) ObjectType() string

func (*AlterPrivilegeRestrictionStmtNode) SetColumnPrivilegeList

func (n *AlterPrivilegeRestrictionStmtNode) SetColumnPrivilegeList(v []*PrivilegeNode)

func (*AlterPrivilegeRestrictionStmtNode) SetObjectType

func (n *AlterPrivilegeRestrictionStmtNode) SetObjectType(v string)

type AlterRowAccessPolicyStmtNode

type AlterRowAccessPolicyStmtNode struct {
	*AlterObjectStmtNode
}

AlterRowAccessPolicyStmtNode this statement:

ALTER ROW ACCESS POLICY [IF EXISTS]
<name> ON <name_path>
<alter_action_list>

<name> is the name of the row access policy to be altered, scoped to the

table in the base <name_path>.

<table_scan> is a TableScan for the target table, which is used during

resolving and validation. Consumers can use either the table
object inside it or base <name_path> to reference the table.

func (*AlterRowAccessPolicyStmtNode) Name

func (*AlterRowAccessPolicyStmtNode) SetName

func (n *AlterRowAccessPolicyStmtNode) SetName(v string)

func (*AlterRowAccessPolicyStmtNode) SetTableScan

func (n *AlterRowAccessPolicyStmtNode) SetTableScan(v *TableScanNode)

func (*AlterRowAccessPolicyStmtNode) TableScan

type AlterSchemaStmtNode

type AlterSchemaStmtNode struct {
	*AlterObjectStmtNode
}

AlterSchemaStmtNode this statement: ALTER SCHEMA [IF NOT EXISTS] <name_path> <alter_action_list>.

type AlterTableSetOptionsStmtNode

type AlterTableSetOptionsStmtNode struct {
	*BaseStatementNode
}

AlterTableSetOptionsStmtNode this statement:

ALTER TABLE [IF EXISTS] <name> SET OPTIONS (...)

NOTE: This is deprecated in favor of AlterTableStmtNode.

<name_path> is a vector giving the identifier path in the table <name>. <option_list> has engine-specific directives that specify how to

alter the metadata for this table.

<is_if_exists> silently ignore the "name_path does not exist" error.

func (*AlterTableSetOptionsStmtNode) AddNamePath

func (n *AlterTableSetOptionsStmtNode) AddNamePath(v string)

func (*AlterTableSetOptionsStmtNode) AddOption

func (n *AlterTableSetOptionsStmtNode) AddOption(v *OptionNode)

func (*AlterTableSetOptionsStmtNode) IsIfExists

func (n *AlterTableSetOptionsStmtNode) IsIfExists() bool

func (*AlterTableSetOptionsStmtNode) NamePath

func (n *AlterTableSetOptionsStmtNode) NamePath() []string

func (*AlterTableSetOptionsStmtNode) OptionList

func (n *AlterTableSetOptionsStmtNode) OptionList() []*OptionNode

func (*AlterTableSetOptionsStmtNode) SetIsIfExists

func (n *AlterTableSetOptionsStmtNode) SetIsIfExists(v bool)

func (*AlterTableSetOptionsStmtNode) SetNamePath

func (n *AlterTableSetOptionsStmtNode) SetNamePath(v []string)

func (*AlterTableSetOptionsStmtNode) SetOptionList

func (n *AlterTableSetOptionsStmtNode) SetOptionList(v []*OptionNode)

type AlterTableStmtNode

type AlterTableStmtNode struct {
	*AlterObjectStmtNode
}

AlterTableStmtNode this statement: ALTER TABLE [IF EXISTS] <name_path> <alter_action_list>.

type AlterViewStmtNode

type AlterViewStmtNode struct {
	*AlterObjectStmtNode
}

AlterViewStmtNode this statement: ALTER VIEW [IF EXISTS] <name_path> <alter_action_list>.

type AnalyticFunctionCallNode

type AnalyticFunctionCallNode struct {
	*BaseNonScalarFunctionCallNode
}

AnalyticFunctionCallNode an analytic function call. The mode of the function is either AGGREGATE or ANALYTIC. This node only ever shows up as a function call in a AnalyticFunctionGroupNode.AnalyticFunctionList. Its associated window is not under this node but as a sibling of its parent node.

WindowFrame can be nil.

func (*AnalyticFunctionCallNode) SetWindowFrame

func (n *AnalyticFunctionCallNode) SetWindowFrame(v *WindowFrameNode)

func (*AnalyticFunctionCallNode) WindowFrame

func (n *AnalyticFunctionCallNode) WindowFrame() *WindowFrameNode

type AnalyticFunctionGroupNode

type AnalyticFunctionGroupNode struct {
	*BaseArgumentNode
}

AnalyticFunctionGroupNode represents a group of analytic function calls that shares PARTITION BY and ORDER BY.

<partition_by> can be NULL. <order_by> may be NULL depending on the functions in <analytic_function_list> and the window frame unit. See (broken link) for more details.

All expressions in <analytic_function_list> have a ResolvedAggregateFunctionCall with a function in mode Function::AGGREGATE or Function::ANALYTIC.

func (*AnalyticFunctionGroupNode) AddAnalyticFunction

func (n *AnalyticFunctionGroupNode) AddAnalyticFunction(v *ComputedColumnNode)

func (*AnalyticFunctionGroupNode) AnalyticFunctionList

func (n *AnalyticFunctionGroupNode) AnalyticFunctionList() []*ComputedColumnNode

func (*AnalyticFunctionGroupNode) OrderBy

func (*AnalyticFunctionGroupNode) PartitionBy

func (*AnalyticFunctionGroupNode) SetAnalyticFunctionList

func (n *AnalyticFunctionGroupNode) SetAnalyticFunctionList(v []*ComputedColumnNode)

func (*AnalyticFunctionGroupNode) SetOrderBy

func (*AnalyticFunctionGroupNode) SetPartitionBy

func (n *AnalyticFunctionGroupNode) SetPartitionBy(v *WindowPartitioningNode)

type AnalyticScanNode

type AnalyticScanNode struct {
	*BaseScanNode
}

AnalyticScanNode apply analytic functions to rows produced from input_scan.

The set of analytic functions are partitioned into a list of analytic function groups <function_group_list> by the window PARTITION BY and the window ORDER BY.

The output <column_list> contains all columns from <input_scan>, one column per analytic function. It may also conain partitioning/ordering expression columns if they reference to select columns.

func (*AnalyticScanNode) AddFunctionGroup

func (n *AnalyticScanNode) AddFunctionGroup(v *AnalyticFunctionGroupNode)

func (*AnalyticScanNode) FunctionGroupList

func (n *AnalyticScanNode) FunctionGroupList() []*AnalyticFunctionGroupNode

func (*AnalyticScanNode) InputScan

func (n *AnalyticScanNode) InputScan() ScanNode

func (*AnalyticScanNode) SetFunctionGroupList

func (n *AnalyticScanNode) SetFunctionGroupList(v []*AnalyticFunctionGroupNode)

func (*AnalyticScanNode) SetInputScan

func (n *AnalyticScanNode) SetInputScan(v ScanNode)

type AnalyzeStmtNode

type AnalyzeStmtNode struct {
	*BaseStatementNode
}

AnalyzeStmtNode represents the ANALYZE statement: ANALYZE [OPTIONS (<option_list>)] [<table_and_column_index_list> [, ...]];

<option_list> is a list of options for ANALYZE.

<table_and_column_info_list> identifies a list of tables along with their related columns that are the target of ANALYZE.

func (*AnalyzeStmtNode) AddOption

func (n *AnalyzeStmtNode) AddOption(v *OptionNode)

func (*AnalyzeStmtNode) AddTableAndColumnIndex

func (n *AnalyzeStmtNode) AddTableAndColumnIndex(v *TableAndColumnInfoNode)

func (*AnalyzeStmtNode) OptionList

func (n *AnalyzeStmtNode) OptionList() []*OptionNode

func (*AnalyzeStmtNode) SetOptionList

func (n *AnalyzeStmtNode) SetOptionList(v []*OptionNode)

func (*AnalyzeStmtNode) SetTableAndColumnIndexList

func (n *AnalyzeStmtNode) SetTableAndColumnIndexList(v []*TableAndColumnInfoNode)

func (*AnalyzeStmtNode) TableAndColumnIndexList

func (n *AnalyzeStmtNode) TableAndColumnIndexList() []*TableAndColumnInfoNode

type AnonymizedAggregateScanNode

type AnonymizedAggregateScanNode struct {
	*BaseAggregateScanNode
}

AnonymizedAggregateScanNode apply differentially private aggregation (anonymization) to rows produced from input_scan, and output anonymized rows.

<k_threshold_expr> when non-null, points to a function call in the <aggregate_list> and adds a filter that acts like:

HAVING <k_threshold_expr> >= <implementation-defined k-threshold>

omitting any rows that would not pass this condition. TODO: Update this comment after splitting the rewriter out into a separate stage.

<anonymization_option_list> provides user-specified options, and requires that option names are one of: delta, epsilon, kappa, or k_threshold.

func (*AnonymizedAggregateScanNode) AddAnonymizationOption

func (n *AnonymizedAggregateScanNode) AddAnonymizationOption(v *OptionNode)

func (*AnonymizedAggregateScanNode) AnonymizationOptionList

func (n *AnonymizedAggregateScanNode) AnonymizationOptionList() []*OptionNode

func (*AnonymizedAggregateScanNode) KThresholdExpr

func (n *AnonymizedAggregateScanNode) KThresholdExpr() *ColumnRefNode

func (*AnonymizedAggregateScanNode) SetAnonymizationOptionList

func (n *AnonymizedAggregateScanNode) SetAnonymizationOptionList(v []*OptionNode)

func (*AnonymizedAggregateScanNode) SetKThresholdExpr

func (n *AnonymizedAggregateScanNode) SetKThresholdExpr(v *ColumnRefNode)

type ArgumentDefNode

type ArgumentDefNode struct {
	*BaseArgumentNode
}

ArgumentDefNode this represents an argument definition, e.g. in a function's argument list.

<name> is the name of the argument; optional for DROP FUNCTION statements. <type> is the type of the argument. <argument_kind> indicates what kind of argument this is, including scalar

vs aggregate.  NOT_AGGREGATE means this is a non-aggregate
argument in an aggregate function, which can only passed constant
values only.

NOTE: Statements that create functions now include a FunctionSignature directly, and an argument_name_list if applicable. These completely describe the function signature, so the ArgumentDefNode list can be considered unnecessary and deprecated. TODO We could remove this node in the future.

func (*ArgumentDefNode) ArgumentKind

func (n *ArgumentDefNode) ArgumentKind() ArgumentKind

func (*ArgumentDefNode) Name

func (n *ArgumentDefNode) Name() string

func (*ArgumentDefNode) SetArgumentKind

func (n *ArgumentDefNode) SetArgumentKind(v ArgumentKind)

func (*ArgumentDefNode) SetName

func (n *ArgumentDefNode) SetName(v string)

func (*ArgumentDefNode) SetType

func (n *ArgumentDefNode) SetType(v types.Type)

func (*ArgumentDefNode) Type

func (n *ArgumentDefNode) Type() types.Type

type ArgumentKind

type ArgumentKind int
const (
	ArgumentKindScalar       ArgumentKind = 0
	ArgumentKindAggregate    ArgumentKind = 1
	ArgumentKindNotAggregate ArgumentKind = 2
)

type ArgumentListNode

type ArgumentListNode struct {
	*BaseArgumentNode
}

ArgumentListNode this statement: [ (<arg_list>) ];

<arg_list> is an optional list of parameters. If given, each parameter

may consist of a type, or a name and a type.

NOTE: This can be considered deprecated in favor of the FunctionSignature

stored directly in the statement.

NOTE: ArgumentListNode is not related to the ArgumentNode,

which just exists to organize node classes.

func (*ArgumentListNode) AddArg

func (n *ArgumentListNode) AddArg(v *ArgumentDefNode)

func (*ArgumentListNode) ArgList

func (n *ArgumentListNode) ArgList() []*ArgumentDefNode

func (*ArgumentListNode) SetArgList

func (n *ArgumentListNode) SetArgList(v []*ArgumentDefNode)

type ArgumentNode

type ArgumentNode interface {
	Node
}

ArgumentNode nodes are not self-contained nodes in the tree. They exist only to describe parameters to another node (e.g. columns in an OrderByNode). This node is here for organizational purposes only, to cluster these argument nodes.

type ArgumentRefNode

type ArgumentRefNode struct {
	*BaseExprNode
}

ArgumentRefNode this represents an argument reference, e.g. in a function's body. <name> is the name of the argument. <argument_kind> is the ArgumentKind from the ArgumentDefNode.

For scalar functions, this is always SCALAR.
For aggregate functions, it can be AGGREGATE or NOT_AGGREGATE.
If NOT_AGGREGATE, then this is a non-aggregate argument
to an aggregate function, which has one constant value
for the entire function call (over all rows in all groups).
(This is copied from the ArgumentDefNode for convenience.)

func (*ArgumentRefNode) ArgumentKind

func (n *ArgumentRefNode) ArgumentKind() ArgumentKind

func (*ArgumentRefNode) Name

func (n *ArgumentRefNode) Name() string

func (*ArgumentRefNode) SetArgumentKind

func (n *ArgumentRefNode) SetArgumentKind(v ArgumentKind)

func (*ArgumentRefNode) SetName

func (n *ArgumentRefNode) SetName(v string)

type ArrayScanNode

type ArrayScanNode struct {
	*BaseScanNode
}

ArrayScanNode scan an array value, produced from some expression.

If input_scan is NULL, this scans the given array value and produces one row per array element. This can occur when using UNNEST(expression).

If <input_scan> is non-NULL, for each row in the stream produced by input_scan, this evaluates the expression <array_expr> (which must return an array type) and then produces a stream with one row per array element.

If <join_expr> is non-NULL, then this condition is evaluated as an ON clause for the array join. The named column produced in <array_expr> may be used inside <join_expr>.

If the array is empty (after evaluating <join_expr>), then

  1. If <is_outer> is false, the scan produces zero rows.
  2. If <is_outer> is true, the scan produces one row with a NULL value for the <element_column>.

<element_column> is the new column produced by this scan that stores the array element value for each row.

If present, <array_offset_column> defines the column produced by this scan that stores the array offset (0-based) for the corresponding <element_column>.

This node's column_list can have columns from input_scan, <element_column> and <array_offset_column>.

func (*ArrayScanNode) ArrayExpr

func (n *ArrayScanNode) ArrayExpr() ExprNode

func (*ArrayScanNode) ArrayOffsetColumn

func (n *ArrayScanNode) ArrayOffsetColumn() *ColumnHolderNode

func (*ArrayScanNode) ElementColumn

func (n *ArrayScanNode) ElementColumn() *Column

func (*ArrayScanNode) InputScan

func (n *ArrayScanNode) InputScan() ScanNode

func (*ArrayScanNode) IsOuter

func (n *ArrayScanNode) IsOuter() bool

func (*ArrayScanNode) JoinExpr

func (n *ArrayScanNode) JoinExpr() ExprNode

func (*ArrayScanNode) SetArrayExpr

func (n *ArrayScanNode) SetArrayExpr(v ExprNode)

func (*ArrayScanNode) SetArrayOffsetColumn

func (n *ArrayScanNode) SetArrayOffsetColumn(v *ColumnHolderNode)

func (*ArrayScanNode) SetElementColumn

func (n *ArrayScanNode) SetElementColumn(v *Column)

func (*ArrayScanNode) SetInputScan

func (n *ArrayScanNode) SetInputScan(v ScanNode)

func (*ArrayScanNode) SetIsOuter

func (n *ArrayScanNode) SetIsOuter(v bool)

func (*ArrayScanNode) SetJoinExpr

func (n *ArrayScanNode) SetJoinExpr(v ExprNode)

type AssertRowsModifiedNode

type AssertRowsModifiedNode struct {
	*BaseArgumentNode
}

AssertRowsModifiedNode represents the ASSERT ROWS MODIFIED clause on a DML statement. The value must be a literal or (possibly casted) parameter int64.

The statement should fail if the number of rows updated does not exactly match this number.

func (*AssertRowsModifiedNode) Rows

func (n *AssertRowsModifiedNode) Rows() ExprNode

func (*AssertRowsModifiedNode) SetRows

func (n *AssertRowsModifiedNode) SetRows(v ExprNode)

type AssertStmtNode

type AssertStmtNode struct {
	*BaseStatementNode
}

AssertStmtNode represents the ASSERT statement:

ASSERT <expression> [AS <description>];

<expression> is any expression that returns a bool. <description> is an optional string literal used to give a more descriptive error message in case the ASSERT fails.

func (*AssertStmtNode) Description

func (n *AssertStmtNode) Description() string

func (*AssertStmtNode) Expression

func (n *AssertStmtNode) Expression() ExprNode

func (*AssertStmtNode) SetDescription

func (n *AssertStmtNode) SetDescription(v string)

func (*AssertStmtNode) SetExpression

func (n *AssertStmtNode) SetExpression(v ExprNode)

type AssignmentStmtNode

type AssignmentStmtNode struct {
	*BaseStatementNode
}

AssignmentStmtNode an assignment of a value to another value.

func (*AssignmentStmtNode) Expr

func (n *AssignmentStmtNode) Expr() ExprNode

Expr value to assign into the target. This will always be the same type as the target.

func (*AssignmentStmtNode) SetExpr

func (n *AssignmentStmtNode) SetExpr(v ExprNode)

func (*AssignmentStmtNode) SetTarget

func (n *AssignmentStmtNode) SetTarget(v ExprNode)

func (*AssignmentStmtNode) Target

func (n *AssignmentStmtNode) Target() ExprNode

Target target of the assignment. currently, this will be either SystemVariableNode, or a chain of GetFieldNode operations around it.

type AuxLoadDataStmtNode

type AuxLoadDataStmtNode struct {
	*BaseStatementNode
}

AuxLoadDataStmtNode LOAD DATA {OVERWRITE|INTO} <table_name> ... FROM FILES ...

This statement loads an external file to a new or existing table.
See (broken link).

<insertion_mode> either OVERWRITE or APPEND (INTO) the destination table. <name_path> the table to load data into. <output_column_list> the list of visible columns of the destination table.

If <column_definition_list> is explicitly specified:
  <output_column_list> =
      <column_definition_list> + <with_partition_columns>
Or if the table already exists:
  <output_column_list> = <name_path>.columns
Last, if the table doesn't exist and <column_definition_list> isn't
explicitly specified:
  <output_column_list> = detected-columns + <with_partition_columns>

<column_definition_list> If not empty, the explicit columns of the

destination table. Must be coerciable from the source file's fields.

When the destination table doesn't already exist, it will be created
with these columns (plus the additional columns from WITH PARTITION
COLUMNS subclause); otherwise, the destination table's schema must
match the explicit columns by both name and type.

<pseudo_column_list> is a list of pseudo-columns expected to be present on

the created table (provided by AnalyzerOptions::SetDdlPseudoColumns*).
These can be referenced in expressions in <partition_by_list> and
<cluster_by_list>.

<primary_key> specifies the PRIMARY KEY constraint on the table. It is

nullptr when no PRIMARY KEY is specified.
If specified, and the table already exists, the primary_key is
required to be the same as that of the existing.

<foreign_key_list> specifies the FOREIGN KEY constraints on the table.

If specified, and the table already exists, the foreign keys are
required to be the same as that of the existing.

<check_constraint_list> specifies the ZETASQL_CHECK constraints on the table.

If specified, and the table already exists, the constraints are
required to be the same as that of the existing.

<partition_by_list> The list of columns to partition the destination

table. Similar to <column_definition_list>, it must match the
destination table's partitioning spec if it already exists.

<cluster_by_list> The list of columns to cluster the destination

table. Similar to <column_definition_list>, it must match the
destination table's partitioning spec if it already exists.

<option_list> the options list describing the destination table.

If the destination doesn't already exist, it will be created with
these options; otherwise it must match the existing destination
table's options.

<with_partition_columns> The columns decoded from partitioned source

files. If the destination table doesn't already exist, these columns
will be implicitly added to the destination table's schema; otherwise
the destination table must already have these columns
(matching by both names and types).

The hive partition columns from the source file do not automatically
partition the destination table. To apply the partition, the
<partition_by_list> must be specified.

<connection> optional connection reference for accessing files. <from_files_option_list> the options list describing the source file(s).

func (*AuxLoadDataStmtNode) AddCheckConstraint

func (n *AuxLoadDataStmtNode) AddCheckConstraint(v *CheckConstraintNode)

func (*AuxLoadDataStmtNode) AddClusterBy

func (n *AuxLoadDataStmtNode) AddClusterBy(v ExprNode)

func (*AuxLoadDataStmtNode) AddColumnDefinition

func (n *AuxLoadDataStmtNode) AddColumnDefinition(v *ColumnDefinitionNode)

func (*AuxLoadDataStmtNode) AddForeignKey

func (n *AuxLoadDataStmtNode) AddForeignKey(v *ForeignKeyNode)

func (*AuxLoadDataStmtNode) AddFromFilesOption

func (n *AuxLoadDataStmtNode) AddFromFilesOption(v *OptionNode)

func (*AuxLoadDataStmtNode) AddNamePath

func (n *AuxLoadDataStmtNode) AddNamePath(v string)

func (*AuxLoadDataStmtNode) AddOption

func (n *AuxLoadDataStmtNode) AddOption(v *OptionNode)

func (*AuxLoadDataStmtNode) AddOutputColumn

func (n *AuxLoadDataStmtNode) AddOutputColumn(v *OutputColumnNode)

func (*AuxLoadDataStmtNode) AddPartitionBy

func (n *AuxLoadDataStmtNode) AddPartitionBy(v ExprNode)

func (*AuxLoadDataStmtNode) AddPseudoColumn

func (n *AuxLoadDataStmtNode) AddPseudoColumn(v *Column)

func (*AuxLoadDataStmtNode) CheckConstraintList

func (n *AuxLoadDataStmtNode) CheckConstraintList() []*CheckConstraintNode

func (*AuxLoadDataStmtNode) ClusterByList

func (n *AuxLoadDataStmtNode) ClusterByList() []ExprNode

func (*AuxLoadDataStmtNode) ColumnDefinitionList

func (n *AuxLoadDataStmtNode) ColumnDefinitionList() []*ColumnDefinitionNode

func (*AuxLoadDataStmtNode) Connection

func (n *AuxLoadDataStmtNode) Connection() *ConnectionNode

func (*AuxLoadDataStmtNode) ForeignKeyList

func (n *AuxLoadDataStmtNode) ForeignKeyList() []*ForeignKeyNode

func (*AuxLoadDataStmtNode) FromFilesOptionList

func (n *AuxLoadDataStmtNode) FromFilesOptionList() []*OptionNode

func (*AuxLoadDataStmtNode) InsertionMode

func (n *AuxLoadDataStmtNode) InsertionMode() InsertionMode

func (*AuxLoadDataStmtNode) NamePath

func (n *AuxLoadDataStmtNode) NamePath() []string

func (*AuxLoadDataStmtNode) OptionList

func (n *AuxLoadDataStmtNode) OptionList() []*OptionNode

func (*AuxLoadDataStmtNode) OutputColumnList

func (n *AuxLoadDataStmtNode) OutputColumnList() []*OutputColumnNode

func (*AuxLoadDataStmtNode) PartitionByList

func (n *AuxLoadDataStmtNode) PartitionByList() []ExprNode

func (*AuxLoadDataStmtNode) PrimaryKey

func (n *AuxLoadDataStmtNode) PrimaryKey() *PrimaryKeyNode

func (*AuxLoadDataStmtNode) PseudoColumnList

func (n *AuxLoadDataStmtNode) PseudoColumnList() []*Column

func (*AuxLoadDataStmtNode) SetCheckConstraintList

func (n *AuxLoadDataStmtNode) SetCheckConstraintList(v []*CheckConstraintNode)

func (*AuxLoadDataStmtNode) SetClusterByList

func (n *AuxLoadDataStmtNode) SetClusterByList(v []ExprNode)

func (*AuxLoadDataStmtNode) SetColumnDefinitionList

func (n *AuxLoadDataStmtNode) SetColumnDefinitionList(v []*ColumnDefinitionNode)

func (*AuxLoadDataStmtNode) SetConnection

func (n *AuxLoadDataStmtNode) SetConnection(v *ConnectionNode)

func (*AuxLoadDataStmtNode) SetForeignKeyList

func (n *AuxLoadDataStmtNode) SetForeignKeyList(v []*ForeignKeyNode)

func (*AuxLoadDataStmtNode) SetFromFilesOptionList

func (n *AuxLoadDataStmtNode) SetFromFilesOptionList(v []*OptionNode)

func (*AuxLoadDataStmtNode) SetInsertionMode

func (n *AuxLoadDataStmtNode) SetInsertionMode(v InsertionMode)

func (*AuxLoadDataStmtNode) SetNamePath

func (n *AuxLoadDataStmtNode) SetNamePath(v []string)

func (*AuxLoadDataStmtNode) SetOptionList

func (n *AuxLoadDataStmtNode) SetOptionList(v []*OptionNode)

func (*AuxLoadDataStmtNode) SetOutputColumnList

func (n *AuxLoadDataStmtNode) SetOutputColumnList(v []*OutputColumnNode)

func (*AuxLoadDataStmtNode) SetPartitionByList

func (n *AuxLoadDataStmtNode) SetPartitionByList(v []ExprNode)

func (*AuxLoadDataStmtNode) SetPrimaryKey

func (n *AuxLoadDataStmtNode) SetPrimaryKey(v *PrimaryKeyNode)

func (*AuxLoadDataStmtNode) SetPseudoColumnList

func (n *AuxLoadDataStmtNode) SetPseudoColumnList(v []*Column)

func (*AuxLoadDataStmtNode) SetWithPartitionColumns

func (n *AuxLoadDataStmtNode) SetWithPartitionColumns(v *WithPartitionColumnsNode)

func (*AuxLoadDataStmtNode) WithPartitionColumns

func (n *AuxLoadDataStmtNode) WithPartitionColumns() *WithPartitionColumnsNode

type BaseAggregateScanNode

type BaseAggregateScanNode struct {
	*BaseScanNode
}

BaseAggregateScanNode base node for aggregation scans. Apply aggregation to rows produced from input_scan, and output aggregated rows.

Group by keys in <group_by_list>. If <group_by_list> is empty, aggregate all input rows into one output row.

<collation_list> is either empty to indicate that all the elements in <group_by_list> have the default collation, or <collation_list> has the same number of elements as <group_by_list>. Each element is the collation for the element in <group_by_list> with the same index, or can be empty to indicate default collation or when the type is not collatable. <collation_list> is only set when FEATURE_V_1_3_COLLATION_SUPPORT is enabled.

Compute all aggregations in <aggregate_list>. All expressions in <aggregate_list> have a AggregateFunctionCallNode with mode Function.AGGREGATE as their outermost node.

The output <column_list> contains only columns produced from <group_by_list> and <aggregate_list>. No other columns are visible after aggregation.

func (*BaseAggregateScanNode) AddAggregate

func (n *BaseAggregateScanNode) AddAggregate(v *ComputedColumnNode)

func (*BaseAggregateScanNode) AddCollation

func (n *BaseAggregateScanNode) AddCollation(v *Collation)

func (*BaseAggregateScanNode) AddGroupBy

func (n *BaseAggregateScanNode) AddGroupBy(v *ComputedColumnNode)

func (*BaseAggregateScanNode) AggregateList

func (n *BaseAggregateScanNode) AggregateList() []*ComputedColumnNode

func (*BaseAggregateScanNode) CollationList

func (n *BaseAggregateScanNode) CollationList() []*Collation

func (*BaseAggregateScanNode) GroupByList

func (n *BaseAggregateScanNode) GroupByList() []*ComputedColumnNode

func (*BaseAggregateScanNode) InputScan

func (n *BaseAggregateScanNode) InputScan() ScanNode

func (*BaseAggregateScanNode) SetAggregateList

func (n *BaseAggregateScanNode) SetAggregateList(v []*ComputedColumnNode)

func (*BaseAggregateScanNode) SetCollationList

func (n *BaseAggregateScanNode) SetCollationList(v []*Collation)

func (*BaseAggregateScanNode) SetGroupByList

func (n *BaseAggregateScanNode) SetGroupByList(v []*ComputedColumnNode)

func (*BaseAggregateScanNode) SetInputScan

func (n *BaseAggregateScanNode) SetInputScan(v ScanNode)

type BaseAlterActionNode

type BaseAlterActionNode struct {
	*BaseArgumentNode
}

type BaseAlterColumnActionNode

type BaseAlterColumnActionNode struct {
	*BaseAlterActionNode
}

func (*BaseAlterColumnActionNode) Column

func (n *BaseAlterColumnActionNode) Column() string

func (*BaseAlterColumnActionNode) IsIfExists

func (n *BaseAlterColumnActionNode) IsIfExists() bool

func (*BaseAlterColumnActionNode) SetColumn

func (n *BaseAlterColumnActionNode) SetColumn(v string)

func (*BaseAlterColumnActionNode) SetIsIfExists

func (n *BaseAlterColumnActionNode) SetIsIfExists(v bool)

type BaseArgumentNode

type BaseArgumentNode struct {
	*BaseNode
}

type BaseConstraintNode

type BaseConstraintNode struct {
	*BaseArgumentNode
}

type BaseCreateStatementNode

type BaseCreateStatementNode struct {
	*BaseStatementNode
}

BaseCreateStatementNode

func (*BaseCreateStatementNode) AddNamePath

func (n *BaseCreateStatementNode) AddNamePath(v string)

func (*BaseCreateStatementNode) CreateMode

func (n *BaseCreateStatementNode) CreateMode() CreateMode

func (*BaseCreateStatementNode) CreateScope

func (n *BaseCreateStatementNode) CreateScope() CreateScope

func (*BaseCreateStatementNode) NamePath

func (n *BaseCreateStatementNode) NamePath() []string

func (*BaseCreateStatementNode) SetCreateMode

func (n *BaseCreateStatementNode) SetCreateMode(v CreateMode)

func (*BaseCreateStatementNode) SetCreateScope

func (n *BaseCreateStatementNode) SetCreateScope(v CreateScope)

func (*BaseCreateStatementNode) SetNamePath

func (n *BaseCreateStatementNode) SetNamePath(v []string)

type BaseCreateTableStmtNode

type BaseCreateTableStmtNode struct {
	*BaseCreateStatementNode
}

BaseCreateTableStmtNode this statement:

CREATE [TEMP] TABLE <name> [(column type, ...) | LIKE <name_path>]
[DEFAULT COLLATE <collation>] [PARTITION BY expr, ...]
[CLUSTER BY expr, ...] [OPTIONS (...)]

<option_list> has engine-specific directives for how and where to

materialize this table.

<column_definition_list> has the names and types of the columns in the

created table. If <is_value_table> is true, it
must contain exactly one column, with a generated
name such as "$struct".

<pseudo_column_list> is a list of some pseudo-columns expected to be

present on the created table (provided by
AnalyzerOptions::SetDdlPseudoColumns*).  These can be
referenced in expressions in <partition_by_list> and
<cluster_by_list>.

<primary_key> specifies the PRIMARY KEY constraint on the table, it is

nullptr when no PRIMARY KEY is specified.

<foreign_key_list> specifies the FOREIGN KEY constraints on the table. <check_constraint_list> specifies the ZETASQL_CHECK constraints on the table. <partition_by_list> specifies the partitioning expressions for the table. <cluster_by_list> specifies the clustering expressions for the table. TODO: Return error when the PARTITION BY / CLUSTER BY expression resolves to have collation specified. <is_value_table> specifies whether the table is a value table. <like_table> identifies the table in the LIKE <name_path>.

By default, all fields (column names, types, constraints,
keys, clustering etc.) will be inherited from the source
table. But if explicitly set, the explicit settings will
take precedence.

<collation_name> specifies the default collation specification to apply to

newly added STRING fields in this table. A change of this field affects
only the STRING columns and the STRING fields in STRUCTs added
afterwards, not existing columns. Only string literals are allowed for
this field.

Note: During table creation or alteration, if a STRING field is added to
this table without explicit collation specified, the engine should copy
the table default collation to the STRING field.

func (*BaseCreateTableStmtNode) AddCheckConstraint

func (n *BaseCreateTableStmtNode) AddCheckConstraint(v *CheckConstraintNode)

func (*BaseCreateTableStmtNode) AddColumnDefinition

func (n *BaseCreateTableStmtNode) AddColumnDefinition(v *ColumnDefinitionNode)

func (*BaseCreateTableStmtNode) AddForeignKey

func (n *BaseCreateTableStmtNode) AddForeignKey(v *ForeignKeyNode)

func (*BaseCreateTableStmtNode) AddOption

func (n *BaseCreateTableStmtNode) AddOption(v *OptionNode)

func (*BaseCreateTableStmtNode) AddPseudoColumn

func (n *BaseCreateTableStmtNode) AddPseudoColumn(v *Column)

func (*BaseCreateTableStmtNode) CheckConstraintList

func (n *BaseCreateTableStmtNode) CheckConstraintList() []*CheckConstraintNode

func (*BaseCreateTableStmtNode) CollationName

func (n *BaseCreateTableStmtNode) CollationName() ExprNode

func (*BaseCreateTableStmtNode) ColumnDefinitionList

func (n *BaseCreateTableStmtNode) ColumnDefinitionList() []*ColumnDefinitionNode

func (*BaseCreateTableStmtNode) ForeignKeyList

func (n *BaseCreateTableStmtNode) ForeignKeyList() []*ForeignKeyNode

func (*BaseCreateTableStmtNode) IsValueTable

func (n *BaseCreateTableStmtNode) IsValueTable() bool

func (*BaseCreateTableStmtNode) LikeTable

func (n *BaseCreateTableStmtNode) LikeTable() types.Table

func (*BaseCreateTableStmtNode) OptionList

func (n *BaseCreateTableStmtNode) OptionList() []*OptionNode

func (*BaseCreateTableStmtNode) PrimaryKey

func (n *BaseCreateTableStmtNode) PrimaryKey() *PrimaryKeyNode

func (*BaseCreateTableStmtNode) PseudoColumnList

func (n *BaseCreateTableStmtNode) PseudoColumnList() []*Column

func (*BaseCreateTableStmtNode) SetCheckConstraintList

func (n *BaseCreateTableStmtNode) SetCheckConstraintList(v []*CheckConstraintNode)

func (*BaseCreateTableStmtNode) SetCollationName

func (n *BaseCreateTableStmtNode) SetCollationName(v ExprNode)

func (*BaseCreateTableStmtNode) SetColumnDefinitionList

func (n *BaseCreateTableStmtNode) SetColumnDefinitionList(v []*ColumnDefinitionNode)

func (*BaseCreateTableStmtNode) SetForeignKeyList

func (n *BaseCreateTableStmtNode) SetForeignKeyList(v []*ForeignKeyNode)

func (*BaseCreateTableStmtNode) SetIsValueTable

func (n *BaseCreateTableStmtNode) SetIsValueTable(v bool)

func (*BaseCreateTableStmtNode) SetLikeTable

func (n *BaseCreateTableStmtNode) SetLikeTable(v types.Table)

func (*BaseCreateTableStmtNode) SetOptionList

func (n *BaseCreateTableStmtNode) SetOptionList(v []*OptionNode)

func (*BaseCreateTableStmtNode) SetPrimaryKey

func (n *BaseCreateTableStmtNode) SetPrimaryKey(v *PrimaryKeyNode)

func (*BaseCreateTableStmtNode) SetPseudoColumnList

func (n *BaseCreateTableStmtNode) SetPseudoColumnList(v []*Column)

type BaseCreateViewNode

type BaseCreateViewNode struct {
	*BaseCreateStatementNode
}

BaseCreateView common node for CREATE view/materialized view:

CREATE [TEMP|MATERIALIZED] [RECURSIVE] VIEW <name> [(...)]
  [OPTIONS (...)]
  AS SELECT ...

<option_list> has engine-specific directives for options attached to

this view.

<output_column_list> has the names and types of the columns in the

created view, and maps from <query>'s column_list
to these output columns. If <has_explicit_columns> is
true, names will be explicitly provided.

<has_explicit_columns> If this is set, the statement includes an explicit

column name list. These column names should still be applied even if the
query changes or is re-resolved in the future. The view becomes invalid
if the query produces a different number of columns.

<query> is the query to run. <sql> is the view query text. <sql_security> is the declared security mode for the function. Values

include 'INVOKER', 'DEFINER'.

<recursive> specifies whether or not the view is created with the

RECURSIVE keyword.

Note that <query> and <sql> are both marked as IGNORABLE because an engine could look at either one (but might not look at both). An engine must look at one (and cannot ignore both) to be semantically valid, but there is currently no way to enforce that.

The view must produce named columns with unique names.

func (*BaseCreateViewNode) AddOption

func (n *BaseCreateViewNode) AddOption(v *OptionNode)

func (*BaseCreateViewNode) AddOutputColumn

func (n *BaseCreateViewNode) AddOutputColumn(v *OutputColumnNode)

func (*BaseCreateViewNode) HasExplicitColumns

func (n *BaseCreateViewNode) HasExplicitColumns() bool

func (*BaseCreateViewNode) IsValueTable

func (n *BaseCreateViewNode) IsValueTable() bool

IsValueTable if true, this view produces a value table. Rather than producing rows with named columns, it produces rows with a single unnamed value type. output_column_list will have exactly one column, with an empty name.

func (*BaseCreateViewNode) OptionList

func (n *BaseCreateViewNode) OptionList() []*OptionNode

func (*BaseCreateViewNode) OutputColumnList

func (n *BaseCreateViewNode) OutputColumnList() []*OutputColumnNode

func (*BaseCreateViewNode) Query

func (n *BaseCreateViewNode) Query() ScanNode

func (*BaseCreateViewNode) Recursive

func (n *BaseCreateViewNode) Recursive() bool

Recursive true if the view uses the RECURSIVE keyword. <query> can be a RecursiveScanNode only if this is true.

func (*BaseCreateViewNode) SQL

func (n *BaseCreateViewNode) SQL() string

func (*BaseCreateViewNode) SQLSecurity

func (n *BaseCreateViewNode) SQLSecurity() SQLSecurity

func (*BaseCreateViewNode) SetHasExplicitColumns

func (n *BaseCreateViewNode) SetHasExplicitColumns(v bool)

func (*BaseCreateViewNode) SetIsValueTable

func (n *BaseCreateViewNode) SetIsValueTable(v bool)

func (*BaseCreateViewNode) SetOptionList

func (n *BaseCreateViewNode) SetOptionList(v []*OptionNode)

func (*BaseCreateViewNode) SetOutputColumnList

func (n *BaseCreateViewNode) SetOutputColumnList(v []*OutputColumnNode)

func (*BaseCreateViewNode) SetQuery

func (n *BaseCreateViewNode) SetQuery(v ScanNode)

func (*BaseCreateViewNode) SetRecursive

func (n *BaseCreateViewNode) SetRecursive(v bool)

func (*BaseCreateViewNode) SetSQL

func (n *BaseCreateViewNode) SetSQL(v string)

func (*BaseCreateViewNode) SetSQLSecurity

func (n *BaseCreateViewNode) SetSQLSecurity(v SQLSecurity)

type BaseExprNode

type BaseExprNode struct {
	*BaseNode
}

func (*BaseExprNode) SetType

func (n *BaseExprNode) SetType(v types.Type)

func (*BaseExprNode) SetTypeAnnotationMap

func (n *BaseExprNode) SetTypeAnnotationMap(v types.AnnotationMap)

func (*BaseExprNode) Type

func (n *BaseExprNode) Type() types.Type

func (*BaseExprNode) TypeAnnotationMap

func (n *BaseExprNode) TypeAnnotationMap() types.AnnotationMap

type BaseFunctionCallNode

type BaseFunctionCallNode struct {
	*BaseExprNode
}

BaseFunctionCallNode common base node for scalar and aggregate function calls.

<argument_list> contains a list of arguments of type ExprNode.

<generic_argument_list> contains an alternative list of generic arguments. This is used for function calls that accept non-expression arguments (i.e. arguments that aren't part of the type system, like lambdas).

If all arguments of this function call are ExprNodes, <argument_list> is used. If any of the argument is not a ExprNode, <generic_argument_list> will be used. Only one of <argument_list> or <generic_argument_list> can be non-empty.

<collation_list> (only set when FEATURE_V_1_3_COLLATION_SUPPORT is enabled) is the operation collation to use. (broken link) lists the functions affected by collation, where this can show up. <collation_list> is a vector for future extension. For now, functions could have at most one element in the <collation_list>.

func (*BaseFunctionCallNode) AddArgument

func (n *BaseFunctionCallNode) AddArgument(v ExprNode)

func (*BaseFunctionCallNode) AddCollation

func (n *BaseFunctionCallNode) AddCollation(v *Collation)

func (*BaseFunctionCallNode) AddGenericArgument

func (n *BaseFunctionCallNode) AddGenericArgument(v *FunctionArgumentNode)

func (*BaseFunctionCallNode) AddHint

func (n *BaseFunctionCallNode) AddHint(v *OptionNode)

func (*BaseFunctionCallNode) ArgumentList

func (n *BaseFunctionCallNode) ArgumentList() []ExprNode

func (*BaseFunctionCallNode) CollationList

func (n *BaseFunctionCallNode) CollationList() []*Collation

func (*BaseFunctionCallNode) ErrorMode

func (n *BaseFunctionCallNode) ErrorMode() ErrorMode

ErrorMode if error_mode=SAFE_ERROR_MODE, and if this function call returns a semantic error (based on input data, not transient server problems), return NULL instead of an error. This is used for functions called using SAFE, as in SAFE.FUNCTION(...).

func (*BaseFunctionCallNode) Function

func (n *BaseFunctionCallNode) Function() *types.Function

Function the matching Function from the Catalog.

func (*BaseFunctionCallNode) GenericArgumentList

func (n *BaseFunctionCallNode) GenericArgumentList() []*FunctionArgumentNode

func (*BaseFunctionCallNode) HintList

func (n *BaseFunctionCallNode) HintList() []*OptionNode

HintList function call hints.

func (*BaseFunctionCallNode) SetArgumentList

func (n *BaseFunctionCallNode) SetArgumentList(v []ExprNode)

func (*BaseFunctionCallNode) SetCollationList

func (n *BaseFunctionCallNode) SetCollationList(v []*Collation)

func (*BaseFunctionCallNode) SetErrorMode

func (n *BaseFunctionCallNode) SetErrorMode(v ErrorMode)

func (*BaseFunctionCallNode) SetFunction

func (n *BaseFunctionCallNode) SetFunction(v *types.Function)

func (*BaseFunctionCallNode) SetGenericArgumentList

func (n *BaseFunctionCallNode) SetGenericArgumentList(v []*FunctionArgumentNode)

func (*BaseFunctionCallNode) SetHintList

func (n *BaseFunctionCallNode) SetHintList(v []*OptionNode)

func (*BaseFunctionCallNode) SetSignature

func (n *BaseFunctionCallNode) SetSignature(v *types.FunctionSignature)

func (*BaseFunctionCallNode) Signature

Signature the concrete FunctionSignature reflecting the matching Function signature and the function's resolved input <argument_list>. The function has the mode AGGREGATE iff it is an aggregate function, in which case this node must be either AggregateFunctionCallNode or AnalyticFunctionCallNode.

type BaseNode

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

func (*BaseNode) ChildNodes

func (n *BaseNode) ChildNodes() []Node

func (*BaseNode) DebugString

func (n *BaseNode) DebugString() string

func (*BaseNode) IsExpression

func (n *BaseNode) IsExpression() bool

func (*BaseNode) IsScan

func (n *BaseNode) IsScan() bool

func (*BaseNode) IsStatement

func (n *BaseNode) IsStatement() bool

func (*BaseNode) Kind

func (n *BaseNode) Kind() Kind

func (*BaseNode) ParseLocationRange added in v0.3.7

func (n *BaseNode) ParseLocationRange() *types.ParseLocationRange

func (*BaseNode) TreeDepth

func (n *BaseNode) TreeDepth() int

type BaseNonScalarFunctionCallNode

type BaseNonScalarFunctionCallNode struct {
	*BaseFunctionCallNode
}

BaseNonScalarFunctionCallNode common base node for scalar and aggregate function calls.

func (*BaseNonScalarFunctionCallNode) AddWithGroupRowsParameter

func (n *BaseNonScalarFunctionCallNode) AddWithGroupRowsParameter(v *ColumnRefNode)

func (*BaseNonScalarFunctionCallNode) Distinct

func (n *BaseNonScalarFunctionCallNode) Distinct() bool

Distinct apply DISTINCT to the stream of input values before calling function.

func (*BaseNonScalarFunctionCallNode) NullHandlingModifier

func (n *BaseNonScalarFunctionCallNode) NullHandlingModifier() NullHandlingModifier

NullHandlingModifier apply IGNORE/RESPECT NULLS filtering to the stream of input values.

func (*BaseNonScalarFunctionCallNode) SetDistinct

func (n *BaseNonScalarFunctionCallNode) SetDistinct(v bool)

func (*BaseNonScalarFunctionCallNode) SetNullHandlingModifier

func (n *BaseNonScalarFunctionCallNode) SetNullHandlingModifier(v NullHandlingModifier)

func (*BaseNonScalarFunctionCallNode) SetWithGroupRowsParameterList

func (n *BaseNonScalarFunctionCallNode) SetWithGroupRowsParameterList(v []*ColumnRefNode)

func (*BaseNonScalarFunctionCallNode) SetWithGroupRowsSubquery

func (n *BaseNonScalarFunctionCallNode) SetWithGroupRowsSubquery(v ScanNode)

func (*BaseNonScalarFunctionCallNode) WithGroupRowsParameterList

func (n *BaseNonScalarFunctionCallNode) WithGroupRowsParameterList() []*ColumnRefNode

WithGroupRowsParameterList correlated parameters to <with_group_rows_subquery>.

func (*BaseNonScalarFunctionCallNode) WithGroupRowsSubquery

func (n *BaseNonScalarFunctionCallNode) WithGroupRowsSubquery() ScanNode

WithGroupRowsSubquery holds a table subquery defined in WITH GROUP_ROWS(...) that is evaluated over the input rows of a AggregateScanNode corresponding to the current group. The function itself is evaluated over the rows returned from the subquery.

The subquery should refer to a special TVF GROUP_ROWS(), which resolves as GroupRowsScanNode. The subquery will be run for each group produced by AggregateScanNode.

GROUP_ROWS() produces a row for each source row in the AggregateScanNode's input that matches current group.

The subquery cannot reference any Columns from the outer query except what comes in via <with_group_rows_parameter_list>, and GROUP_ROWS().

The subquery can return more than one column, and these columns can be referenced by the function.

The subquery can be correlated. In this case the <with_group_rows_parameter_list> gives the set of Columns from outside the subquery that are used inside. The subuery cannot refer to correlated columns that are used as aggregation input in the immediate outer query. The same rules apply to <with_group_rows_parameter_list> as in SubqueryExprNode.

type BaseScanNode

type BaseScanNode struct {
	*BaseNode
}

func (*BaseScanNode) AddColumn

func (n *BaseScanNode) AddColumn(v *Column)

func (*BaseScanNode) AddHint

func (n *BaseScanNode) AddHint(v *OptionNode)

func (*BaseScanNode) ColumnList

func (n *BaseScanNode) ColumnList() []*Column

func (*BaseScanNode) HintList

func (n *BaseScanNode) HintList() []*OptionNode

func (*BaseScanNode) IsOrdered

func (n *BaseScanNode) IsOrdered() bool

func (*BaseScanNode) SetColumnList

func (n *BaseScanNode) SetColumnList(v []*Column)

func (*BaseScanNode) SetHintList

func (n *BaseScanNode) SetHintList(v []*OptionNode)

func (*BaseScanNode) SetIsOrdered

func (n *BaseScanNode) SetIsOrdered(v bool)

type BaseStatementNode

type BaseStatementNode struct {
	*BaseNode
}

BaseStatementNode

func (*BaseStatementNode) AddHint

func (n *BaseStatementNode) AddHint(v *OptionNode)

func (*BaseStatementNode) HintList

func (n *BaseStatementNode) HintList() []*OptionNode

func (*BaseStatementNode) SetHintList

func (n *BaseStatementNode) SetHintList(v []*OptionNode)

type BeginStmtNode

type BeginStmtNode struct {
	*BaseStatementNode
}

BeginStmtNode this statement: BEGIN [TRANSACTION] [ <transaction_mode> [, ...] ]

Where transaction_mode is one of:

READ ONLY
READ WRITE
<isolation_level>

<isolation_level> is a string vector storing the identifiers after

ISOLATION LEVEL. The strings inside vector could be one of the
SQL standard isolation levels:

            READ UNCOMMITTED
            READ COMMITTED
            READ REPEATABLE
            SERIALIZABLE

or could be arbitrary strings. ZetaSQL does not validate that
the string is valid.

func (*BeginStmtNode) AddIsolationLevel

func (n *BeginStmtNode) AddIsolationLevel(v string)

func (*BeginStmtNode) IsolationLevelList

func (n *BeginStmtNode) IsolationLevelList() []string

func (*BeginStmtNode) ReadWriteMode

func (n *BeginStmtNode) ReadWriteMode() ReadWriteMode

func (*BeginStmtNode) SetIsolationLevelList

func (n *BeginStmtNode) SetIsolationLevelList(v []string)

func (*BeginStmtNode) SetReadWriteMode

func (n *BeginStmtNode) SetReadWriteMode(v ReadWriteMode)

type BoundaryType

type BoundaryType int
const (
	UnboundedPrecedingType BoundaryType = 0
	OffsetPrecedingType    BoundaryType = 1
	CurrentRowType         BoundaryType = 2
	OffsetFollowingType    BoundaryType = 3
	UnboundedFollowingType BoundaryType = 4
)

type CallStmtNode

type CallStmtNode struct {
	*BaseStatementNode
}

CallStmtNode this statement: CALL <procedure>;

<procedure> Procedure to call. <signature> Resolved FunctionSignature for this procedure. <argument_list> Procedure arguments.

func (*CallStmtNode) AddArgument

func (n *CallStmtNode) AddArgument(v ExprNode)

func (*CallStmtNode) ArgumentList

func (n *CallStmtNode) ArgumentList() []ExprNode

func (*CallStmtNode) Procedure

func (n *CallStmtNode) Procedure() types.Procedure

func (*CallStmtNode) SetArgumentList

func (n *CallStmtNode) SetArgumentList(v []ExprNode)

func (*CallStmtNode) SetProcedure

func (n *CallStmtNode) SetProcedure(v types.Procedure)

func (*CallStmtNode) SetSignature

func (n *CallStmtNode) SetSignature(v *types.FunctionSignature)

func (*CallStmtNode) Signature

func (n *CallStmtNode) Signature() *types.FunctionSignature

type CastNode

type CastNode struct {
	*BaseExprNode
}

CastNode a cast expression, casting the result of an input expression to the target Type.

Valid casts are defined in the CastHashMap, which identifies valid from-Type, to-Type pairs. Consumers can access it through ZetaSQLCasts().

func (*CastNode) Expr

func (n *CastNode) Expr() ExprNode

func (*CastNode) ExtendedCast

func (n *CastNode) ExtendedCast() *ExtendedCastNode

ExtendedCast if at least one of types involved in this cast is or contains an extended (TYPE_EXTENDED) type, this field contains information necessary to execute this cast.

func (*CastNode) Format

func (n *CastNode) Format() ExprNode

Format the format string specified by the optional FORMAT clause. It is nullptr when the clause does not exist.

func (*CastNode) ReturnNullOnError

func (n *CastNode) ReturnNullOnError() bool

ReturnNullOnError whether to return NULL if the cast fails. This is set to true for SAFE_CAST.

func (*CastNode) SetExpr

func (n *CastNode) SetExpr(v ExprNode)

func (*CastNode) SetExtendedCast

func (n *CastNode) SetExtendedCast(v *ExtendedCastNode)

func (*CastNode) SetFormat

func (n *CastNode) SetFormat(v ExprNode)

func (*CastNode) SetReturnNullOnError

func (n *CastNode) SetReturnNullOnError(v bool)

func (*CastNode) SetTimeZone

func (n *CastNode) SetTimeZone(v ExprNode)

func (*CastNode) SetTypeParameters

func (n *CastNode) SetTypeParameters(v *types.TypeParameters)

func (*CastNode) TimeZone

func (n *CastNode) TimeZone() ExprNode

TimeZone the time zone expression by the optional AT TIME ZONE clause. It is nullptr when the clause does not exist.

func (*CastNode) TypeParameters

func (n *CastNode) TypeParameters() *types.TypeParameters

TypeParameters contains the TypeParametersProto, which stores the type parameters if specified in a cast. If there are no type parameters, this proto will be empty.

If type parameters are specified, the result of the cast should conform to the type parameters. Engines are expected to enforce type parameter constraints by erroring out or truncating the cast result, depending on the output type.

For example:

CAST("ABC" as STRING(2)) should error out
CAST(1234 as NUMERIC(2)) should error out
CAST(1.234 as NUMERIC(2,1)) should return a NumericValue of 1.2

type CheckConstraintNode

type CheckConstraintNode struct {
	*BaseConstraintNode
}

CheckConstraintNode this represents the ZETASQL_CHECK constraint on a table. It is of the form:

CONSTRAINT <constraint_name>
ZETASQL_CHECK <expression>
<enforced>
<option_list>

<constraint_name> uniquely identifies the constraint.

<expression> defines a boolean expression to be evaluated when the row is updated. If the result is FALSE, update to the row is not allowed.

<enforced> specifies whether or not the constraint is enforced.

<option_list> list of options for check constraint.

func (*CheckConstraintNode) AddOption

func (n *CheckConstraintNode) AddOption(v *OptionNode)

func (*CheckConstraintNode) ConstraintName

func (n *CheckConstraintNode) ConstraintName() string

func (*CheckConstraintNode) Enforced

func (n *CheckConstraintNode) Enforced() bool

func (*CheckConstraintNode) Expression

func (n *CheckConstraintNode) Expression() ExprNode

func (*CheckConstraintNode) OptionList

func (n *CheckConstraintNode) OptionList() []*OptionNode

func (*CheckConstraintNode) SetConstraintName

func (n *CheckConstraintNode) SetConstraintName(v string)

func (*CheckConstraintNode) SetEnforced

func (n *CheckConstraintNode) SetEnforced(v bool)

func (*CheckConstraintNode) SetExpression

func (n *CheckConstraintNode) SetExpression(v ExprNode)

func (*CheckConstraintNode) SetOptionList

func (n *CheckConstraintNode) SetOptionList(v []*OptionNode)

type CloneDataStmtNode

type CloneDataStmtNode struct {
	*BaseStatementNode
}

CloneDataStmtNode CLONE DATA INTO <table_name> FROM ...

<target_table> the table to clone data into. Cannot be value table. <clone_from> The source table(s) to clone data from.

For a single table, the scan is TableScan, with an optional
    for_system_time_expr;
If WHERE clause is present, the Scan is wrapped inside
    FilterScanNode;
When multiple sources are present, they are UNION'ed together
    in a SetOperationScanNode.

Constraints:
  The target_table must not be the same as any source table,
  and two sources cannot refer to the same table.
  All source tables and target table must have equal number
  of columns, with positionally identical column names and
  types.
  Cannot be value table.

func (*CloneDataStmtNode) CloneFrom

func (n *CloneDataStmtNode) CloneFrom() ScanNode

func (*CloneDataStmtNode) SetCloneFrom

func (n *CloneDataStmtNode) SetCloneFrom(v ScanNode)

func (*CloneDataStmtNode) SetTargetTable

func (n *CloneDataStmtNode) SetTargetTable(v *TableScanNode)

func (*CloneDataStmtNode) TargetTable

func (n *CloneDataStmtNode) TargetTable() *TableScanNode

type Collation

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

Collation is used with types.Type to indicate the resolved collation for the type. For nested types, see comments on <child_list_> for how collation on subfield(s) are stored. This is always stored in a normalized form, meaning on all the nested levels, it has either an empty <child_list_> to indicate that it has no collation in any child, or it has at least one non-empty child.

func (*Collation) ChildList

func (c *Collation) ChildList() []*Collation

ChildList children only exist if any of the children have a collation.

func (*Collation) CollationName

func (c *Collation) CollationName() string

func (*Collation) DebugString

func (c *Collation) DebugString() string

func (*Collation) Empty

func (c *Collation) Empty() bool

Empty returns true if current type has no collation and has no children with collation.

func (*Collation) Equals

func (c *Collation) Equals(that *Collation) bool

func (*Collation) HasCollation

func (c *Collation) HasCollation() bool

HasCollation collation on current type (STRING), not on subfields.

func (*Collation) HasCompatibleStructure

func (c *Collation) HasCompatibleStructure(typ types.Type) bool

HasCompatibleStructure returns true if this Collation has compatible nested structure with <type>. The structures are compatible when they meet the conditions below:

  • The Collation instance is either empty or is compatible by recursively following these rules. When it is empty, it indicates that the collation is empty on all the nested levels, and therefore such instance is compatible with any Type (including structs and arrays).
  • This instance has collation and the <type> is a STRING type.
  • This instance has non-empty child_list and the <type> is a STRUCT, the number of children matches the number of struct fields, and the children have a compatible structure with the corresponding struct field types.
  • This instance has exactly one child and <type> is an ARRAY, and the child has a compatible structure with the array's element type.

type Column

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

Column a column produced by part of a query (e.g. a scan or subquery).

This is used in the column_list of a resolved AST node to represent a "slot" in the "tuple" produced by that logical operator. This is also used in expressions in ColumnRefNode to point at the column selected during name resolution.

The column_id is the definitive identifier for a Column, and the column_id should be used to match a ColumnRefNode in an expression to the scan that produces that column. column_ids are unique within a query. If the same table is scanned multiple times, distinct column_ids will be chosen for each scan.

Joins and other combining nodes may propagate Columns from their inputs, with the same column_ids.

func (*Column) AnnotatedType

func (c *Column) AnnotatedType() *types.AnnotatedType

func (*Column) Clear

func (c *Column) Clear()

func (*Column) ColumnID

func (c *Column) ColumnID() int

func (*Column) DebugString

func (c *Column) DebugString() string

func (*Column) IsInitialized

func (c *Column) IsInitialized() bool

func (*Column) Name

func (c *Column) Name() string

func (*Column) NameID

func (c *Column) NameID() string

func (*Column) ShortDebugString

func (c *Column) ShortDebugString() string

func (*Column) TableName

func (c *Column) TableName() string

func (*Column) TableNameID

func (c *Column) TableNameID() string

func (*Column) Type

func (c *Column) Type() types.Type

func (*Column) TypeAnnotationMap

func (c *Column) TypeAnnotationMap() types.AnnotationMap

type ColumnAnnotationsNode

type ColumnAnnotationsNode struct {
	*BaseArgumentNode
}

ColumnAnnotationsNode this is used in CREATE TABLE statements to provide column annotations such as collation, NOT NULL, type parameters, and OPTIONS().

This class is recursive. It mirrors the structure of the column type except that child_list might be truncated.

For ARRAY:

If the element or its subfield has annotations, then child_list.size()
is 1, and child_list(0) stores the element annotations.
Otherwise child_list is empty.

For STRUCT:

If the i-th field has annotations then child_list(i) stores the
field annotations.
Otherwise either child_list.size() <= i or child_list(i) is trivial.
If none of the fields and none of their subfields has annotations, then
child_list is empty.

For other types, child_list is empty.

func (*ColumnAnnotationsNode) AddChild

func (*ColumnAnnotationsNode) AddOption

func (n *ColumnAnnotationsNode) AddOption(v *OptionNode)

func (*ColumnAnnotationsNode) ChildList

func (n *ColumnAnnotationsNode) ChildList() []*ColumnAnnotationsNode

func (*ColumnAnnotationsNode) CollationName

func (n *ColumnAnnotationsNode) CollationName() ExprNode

CollationName can only be a string literal, and is only set when FEATURE_V_1_3_COLLATION_SUPPORT is enabled.

func (*ColumnAnnotationsNode) NotNull

func (n *ColumnAnnotationsNode) NotNull() bool

func (*ColumnAnnotationsNode) OptionList

func (n *ColumnAnnotationsNode) OptionList() []*OptionNode

func (*ColumnAnnotationsNode) SetChildList

func (n *ColumnAnnotationsNode) SetChildList(v []*ColumnAnnotationsNode)

func (*ColumnAnnotationsNode) SetCollationName

func (n *ColumnAnnotationsNode) SetCollationName(v ExprNode)

func (*ColumnAnnotationsNode) SetNotNull

func (n *ColumnAnnotationsNode) SetNotNull(v bool)

func (*ColumnAnnotationsNode) SetOptionList

func (n *ColumnAnnotationsNode) SetOptionList(v []*OptionNode)

func (*ColumnAnnotationsNode) SetTypeParameters

func (n *ColumnAnnotationsNode) SetTypeParameters(v *types.TypeParameters)

func (*ColumnAnnotationsNode) TypeParameters

func (n *ColumnAnnotationsNode) TypeParameters() *types.TypeParameters

TypeParameters child_list in <type_parameters> is not used in here. Instead we use child_list of this node (ColumnAnnotationsNode) to store type parameters of subfields of STRUCT or ARRAY. Users can access the full type parameters with child_list by calling ColumnDefinitionNode.FullTypeParameters() function.

type ColumnDefaultValueNode

type ColumnDefaultValueNode struct {
	*BaseArgumentNode
}

ColumnDefaultValueNode <expression> is the default value expression of the column. The type of the expression must be coercible to the column type.

  • <default_value> cannot contain any references to another column.
  • <default_value> cannot include a subquery, aggregation, or window function.

<sql> is the original SQL string for the default value expression.

Since we can't enforce engines to access at least one of the fields, we leave both fields NOT_IGNORABLE to ensure engines access at least one of them.

func (*ColumnDefaultValueNode) Expression

func (n *ColumnDefaultValueNode) Expression() ExprNode

func (*ColumnDefaultValueNode) SQL

func (n *ColumnDefaultValueNode) SQL() string

func (*ColumnDefaultValueNode) SetExpression

func (n *ColumnDefaultValueNode) SetExpression(v ExprNode)

func (*ColumnDefaultValueNode) SetSQL

func (n *ColumnDefaultValueNode) SetSQL(v string)

type ColumnDefinitionNode

type ColumnDefinitionNode struct {
	*BaseArgumentNode
}

ColumnDefinitionNode this is used in CREATE TABLE statements to provide an explicit column definition.

if <is_hidden> is TRUE, then the column won't show up in SELECT * queries.

if <generated_column_info> is non-NULL, then this column is a generated column.

if <default_value> is non-NULL, then this column has default value.

<generated_column_info> and <default_value> cannot both be set at the same time.

<column> defines an ID for the column, which may appear in expressions in the PARTITION BY, CLUSTER BY clause or <generated_column_info> if either is present.

func (*ColumnDefinitionNode) Annotations

func (n *ColumnDefinitionNode) Annotations() *ColumnAnnotationsNode

func (*ColumnDefinitionNode) Column

func (n *ColumnDefinitionNode) Column() *Column

func (*ColumnDefinitionNode) DefaultValue

func (n *ColumnDefinitionNode) DefaultValue() *ColumnDefaultValueNode

func (*ColumnDefinitionNode) GeneratedColumnInfo

func (n *ColumnDefinitionNode) GeneratedColumnInfo() *GeneratedColumnInfoNode

func (*ColumnDefinitionNode) IsHidden

func (n *ColumnDefinitionNode) IsHidden() bool

func (*ColumnDefinitionNode) Name

func (n *ColumnDefinitionNode) Name() string

func (*ColumnDefinitionNode) SetAnnotations

func (n *ColumnDefinitionNode) SetAnnotations(v *ColumnAnnotationsNode)

func (*ColumnDefinitionNode) SetColumn

func (n *ColumnDefinitionNode) SetColumn(v *Column)

func (*ColumnDefinitionNode) SetDefaultValue

func (n *ColumnDefinitionNode) SetDefaultValue(v *ColumnDefaultValueNode)

func (*ColumnDefinitionNode) SetGeneratedColumnInfo

func (n *ColumnDefinitionNode) SetGeneratedColumnInfo(v *GeneratedColumnInfoNode)

func (*ColumnDefinitionNode) SetIsHidden

func (n *ColumnDefinitionNode) SetIsHidden(v bool)

func (*ColumnDefinitionNode) SetName

func (n *ColumnDefinitionNode) SetName(v string)

func (*ColumnDefinitionNode) SetType

func (n *ColumnDefinitionNode) SetType(v types.Type)

func (*ColumnDefinitionNode) Type

func (n *ColumnDefinitionNode) Type() types.Type

type ColumnHolderNode

type ColumnHolderNode struct {
	*BaseArgumentNode
}

ColumnHolderNode this wrapper is used for an optional Column inside another node.

func (*ColumnHolderNode) Column

func (n *ColumnHolderNode) Column() *Column

func (*ColumnHolderNode) SetColumn

func (n *ColumnHolderNode) SetColumn(v *Column)

type ColumnRefNode

type ColumnRefNode struct {
	*BaseExprNode
}

ColumnRefNode an expression referencing the value of some column visible in the current Scan node.

If isCorrelated is false, this must be a column visible in the Scan containing this expression, either because it was produced inside that Scan or it is on the ColumnList of some child of this Scan.

If IsCorrelated is true, this references a column from outside a subquery that is visible as a correlated column inside. The column referenced here must show up on the parameters list for the subquery. See SubqueryExprNode.

func (*ColumnRefNode) Column

func (n *ColumnRefNode) Column() *Column

func (*ColumnRefNode) IsCorrelated

func (n *ColumnRefNode) IsCorrelated() bool

func (*ColumnRefNode) SetColumn

func (n *ColumnRefNode) SetColumn(v *Column)

func (*ColumnRefNode) SetIsCorrelated

func (n *ColumnRefNode) SetIsCorrelated(v bool)

type CommitStmtNode

type CommitStmtNode struct {
	*BaseStatementNode
}

CommitStmtNode this statement: COMMIT [TRANSACTION];

type ComputedColumnNode

type ComputedColumnNode struct {
	*BaseArgumentNode
}

ComputedColumnNode this is used when an expression is computed and given a name (a new Column) that can be referenced elsewhere. The new Column can appear in a column_list or in ColumnRefsNode in other expressions, when appropriate. This node is not an expression itself - it is a container that holds an expression.

func (*ComputedColumnNode) Column

func (n *ComputedColumnNode) Column() *Column

func (*ComputedColumnNode) Expr

func (n *ComputedColumnNode) Expr() ExprNode

func (*ComputedColumnNode) SetColumn

func (n *ComputedColumnNode) SetColumn(v *Column)

func (*ComputedColumnNode) SetExpr

func (n *ComputedColumnNode) SetExpr(v ExprNode)

type ConnectionNode

type ConnectionNode struct {
	*BaseArgumentNode
}

ConnectionNode represents a connection object as a TVF argument. <connection> is the connection object encapsulated metadata to connect to an external data source.

func (*ConnectionNode) Connection

func (n *ConnectionNode) Connection() types.Connection

func (*ConnectionNode) SetConnection

func (n *ConnectionNode) SetConnection(v types.Connection)

type ConstantNode

type ConstantNode struct {
	*BaseExprNode
}

ConstantNode reference to a named constant.

func (*ConstantNode) Constant

func (n *ConstantNode) Constant() types.Constant

Constant the matching Constant from the Catalog.

func (*ConstantNode) SetConstant

func (n *ConstantNode) SetConstant(v types.Constant)

type ConstraintNode

type ConstraintNode interface {
	ArgumentNode
}

ConstraintNode intermediate node for constraints.

type CreateConstantStmtNode

type CreateConstantStmtNode struct {
	*BaseCreateStatementNode
}

CreateConstantStmtNode this statement creates a user-defined named constant: CREATE [OR REPLACE] [TEMP | TEMPORARY | PUBLIC | PRIVATE] CONSTANT

[IF NOT EXISTS] <name_path> = <expression>

<name_path> is the identifier path of the named constants. <expr> is the expression that determines the type and the value of the

named constant. Note that <expr> need not be constant. Its value
is bound to the named constant which is then treated as
immutable. <expr> can be evaluated at the time this statement is
processed or later (lazy evaluation during query execution).

func (*CreateConstantStmtNode) Expr

func (n *CreateConstantStmtNode) Expr() ExprNode

func (*CreateConstantStmtNode) SetExpr

func (n *CreateConstantStmtNode) SetExpr(v ExprNode)

type CreateDatabaseStmtNode

type CreateDatabaseStmtNode struct {
	*BaseStatementNode
}

CreateDatabaseStmtNode this statement:

CREATE DATABASE <name> [OPTIONS (...)]

<name_path> is a vector giving the identifier path in the database name. <option_list> specifies the options of the database.

func (*CreateDatabaseStmtNode) AddNamePath

func (n *CreateDatabaseStmtNode) AddNamePath(v string)

func (*CreateDatabaseStmtNode) AddOption

func (n *CreateDatabaseStmtNode) AddOption(v *OptionNode)

func (*CreateDatabaseStmtNode) NamePath

func (n *CreateDatabaseStmtNode) NamePath() []string

func (*CreateDatabaseStmtNode) OptionList

func (n *CreateDatabaseStmtNode) OptionList() []*OptionNode

func (*CreateDatabaseStmtNode) SetNamePath

func (n *CreateDatabaseStmtNode) SetNamePath(v []string)

func (*CreateDatabaseStmtNode) SetOptionList

func (n *CreateDatabaseStmtNode) SetOptionList(v []*OptionNode)

type CreateEntityStmtNode

type CreateEntityStmtNode struct {
	*BaseCreateStatementNode
}

CreateEntityStmtNode this statement: CREATE [OR REPLACE] <entity_type> [IF NOT EXISTS] <path_expression> [OPTIONS <option_list>] [AS <entity_body_json>];

At most one of <entity_body_json>, <entity_body_text> can be non-empty.

<entity_type> engine-specific entity type to be created. <entity_body_json> is a JSON literal to be interpreted by engine. <entity_body_text> is a text literal to be interpreted by engine. <option_list> has engine-specific directives for how to

create this entity.

func (*CreateEntityStmtNode) AddOption

func (n *CreateEntityStmtNode) AddOption(v *OptionNode)

func (*CreateEntityStmtNode) EntityBodyJSON

func (n *CreateEntityStmtNode) EntityBodyJSON() string

func (*CreateEntityStmtNode) EntityBodyText

func (n *CreateEntityStmtNode) EntityBodyText() string

func (*CreateEntityStmtNode) EntityType

func (n *CreateEntityStmtNode) EntityType() string

func (*CreateEntityStmtNode) OptionList

func (n *CreateEntityStmtNode) OptionList() []*OptionNode

func (*CreateEntityStmtNode) SetEntityBodyJSON

func (n *CreateEntityStmtNode) SetEntityBodyJSON(v string)

func (*CreateEntityStmtNode) SetEntityBodyText

func (n *CreateEntityStmtNode) SetEntityBodyText(v string)

func (*CreateEntityStmtNode) SetEntityType

func (n *CreateEntityStmtNode) SetEntityType(v string)

func (*CreateEntityStmtNode) SetOptionList

func (n *CreateEntityStmtNode) SetOptionList(v []*OptionNode)

type CreateExternalTableStmtNode

type CreateExternalTableStmtNode struct {
	*BaseCreateTableStmtNode
}

CreateExternalTableStmtNode this statement: CREATE [TEMP] EXTERNAL TABLE <name> [(column type, ...)] [DEFAULT COLLATE <collation_name>] [WITH PARTITION COLUMN [(column type, ...)]] [WITH CONNECTION connection_name] OPTIONS (...)

func (*CreateExternalTableStmtNode) Connection

func (*CreateExternalTableStmtNode) SetConnection

func (n *CreateExternalTableStmtNode) SetConnection(v *ConnectionNode)

func (*CreateExternalTableStmtNode) SetWithPartitionColumns

func (n *CreateExternalTableStmtNode) SetWithPartitionColumns(v *WithPartitionColumnsNode)

func (*CreateExternalTableStmtNode) WithPartitionColumns

func (n *CreateExternalTableStmtNode) WithPartitionColumns() *WithPartitionColumnsNode

type CreateFunctionStmtNode

type CreateFunctionStmtNode struct {
	*BaseCreateStatementNode
}

CreateFunctionStmtNode this statement creates a user-defined function:

CREATE [TEMP] FUNCTION [IF NOT EXISTS] <name_path> (<arg_list>)
  [RETURNS <return_type>] [SQL SECURITY <sql_security>]
  [<determinism_level>]
  [[LANGUAGE <language>] [AS <code> | AS ( <function_expression> )]
   | REMOTE [WITH CONNECTION <connection>]]
  [OPTIONS (<option_list>)]

<name_path> is the identifier path of the function.
<has_explicit_return_type> is true iff RETURNS clause is present.
<return_type> is the return type for the function, which can be any
       valid ZetaSQL type, including ARRAY or STRUCT. It is inferred
       from <function_expression> if not explicitly set.
       TODO: Deprecate and remove this. The return type is
       already specified by the <signature>.
<argument_name_list> The names of the function arguments.
<signature> is the FunctionSignature of the created function, with all
       options.  This can be used to create a Function to load into a
       Catalog for future queries.
<is_aggregate> is true if this is an aggregate function.  All arguments
       are assumed to be aggregate input arguments that may vary for
       every row.
<language> is the programming language used by the function. This field
       is set to 'SQL' for SQL functions and 'REMOTE' for remote
       functions and otherwise to the language name specified in the
       LANGUAGE clause. This field is set to 'REMOTE' iff <is_remote> is
       set to true.
<code> is a string literal that contains the function definition.  Some
       engines may allow this argument to be omitted for certain types
       of external functions. This will always be set for SQL functions.
<aggregate_expression_list> is a list of SQL aggregate functions to
       compute prior to computing the final <function_expression>.
       See below.
<function_expression> is the resolved SQL expression invoked for the
       function. This will be unset for external language functions. For
       non-template SQL functions, this is a resolved representation of
       the expression in <code>.
<option_list> has engine-specific directives for modifying functions.
<sql_security> is the declared security mode for the function. Values
       include 'INVOKER', 'DEFINER'.
<determinism_level> is the declared determinism level of the function.
       Values are 'DETERMINISTIC', 'NOT DETERMINISTIC', 'IMMUTABLE',
       'STABLE', 'VOLATILE'.
<is_remote> is true if this is an remote function. It is true iff its
       <language> is set to 'REMOTE'.
<connection> is the identifier path of the connection object. It can be
       only set when <is_remote> is true.

Note that <function_expression> and <code> are both marked as IGNORABLE because an engine could look at either one (but might not look at both). An engine must look at one (and cannot ignore both, unless the function is remote) to be semantically valid, but there is currently no way to enforce that.

For aggregate functions, <is_aggregate> will be true. Aggregate functions will only occur if LanguageOptions has FEATURE_CREATE_AGGREGATE_FUNCTION enabled.

Arguments to aggregate functions must have <FunctionSignatureArgumentTypeOptions::is_not_aggregate> true or false. Non-aggregate arguments must be passed constant values only.

For SQL aggregate functions, there will be both an <aggregate_expression_list>, with aggregate expressions to compute first, and then a final <function_expression> to compute on the results of the aggregates. Each aggregate expression is a AggregateFunctionCallNode, and may reference any input arguments. Each ComputedColumnNode in <aggregate_expression_list> gives the aggregate expression a column id. The final <function_expression> can reference these created aggregate columns, and any input arguments with <argument_kind>=NOT_AGGREGATE.

For example, with

CREATE TEMP FUNCTION my_avg(x) = (SUM(x) / COUNT(x));

we would have an <aggregate_expression_list> with

agg1#1 := SUM(ArgumentRefNode(x))
agg2#2 := COUNT(ArgumentRefNode(x))

and a <function_expression>

ColumnRefNode(agg1#1) / ColumnRefNode(agg2#2)

For example, with

CREATE FUNCTION scaled_avg(x,y NOT AGGREGATE) = (SUM(x) / COUNT(x) * y);

we would have an <aggregate_expression_list> with

agg1#1 := SUM(ArgumentRefNode(x))
agg2#2 := COUNT(ArgumentRefNode(x))

and a <function_expression>

ColumnRefNode(agg1#1) / ColumnRefNode(agg2#2) * ArgumentRefNode(y)

When resolving a query that calls an aggregate UDF, the query will have a AggregateScanNode that invokes the UDF function. The engine should remove the UDF aggregate function from the <aggregate_list>, and instead compute the additional aggregates from the UDF's <aggregate_expression_list>, and then add an additional Project to compute the final <function_expression>, which should produce the value for the original AggregateScanNode's computed column for the UDF. Some rewrites of the Column references inside the UDF will be required. TODO If using Columns makes this renaming too complicated, we could switch to use ArgumentRefNodes, or something new.

func (*CreateFunctionStmtNode) AddAggregateExpression

func (n *CreateFunctionStmtNode) AddAggregateExpression(v *ComputedColumnNode)

func (*CreateFunctionStmtNode) AddArgumentName

func (n *CreateFunctionStmtNode) AddArgumentName(v string)

func (*CreateFunctionStmtNode) AddOption

func (n *CreateFunctionStmtNode) AddOption(v *OptionNode)

func (*CreateFunctionStmtNode) AggregateExpressionList

func (n *CreateFunctionStmtNode) AggregateExpressionList() []*ComputedColumnNode

func (*CreateFunctionStmtNode) ArgumentNameList

func (n *CreateFunctionStmtNode) ArgumentNameList() []string

func (*CreateFunctionStmtNode) Code

func (n *CreateFunctionStmtNode) Code() string

func (*CreateFunctionStmtNode) Connection

func (n *CreateFunctionStmtNode) Connection() *ConnectionNode

func (*CreateFunctionStmtNode) DeterminismLevel

func (n *CreateFunctionStmtNode) DeterminismLevel() DeterminismLevel

func (*CreateFunctionStmtNode) FunctionExpression

func (n *CreateFunctionStmtNode) FunctionExpression() ExprNode

func (*CreateFunctionStmtNode) HasExplicitReturnType

func (n *CreateFunctionStmtNode) HasExplicitReturnType() bool

func (*CreateFunctionStmtNode) IsAggregate

func (n *CreateFunctionStmtNode) IsAggregate() bool

func (*CreateFunctionStmtNode) IsRemote

func (n *CreateFunctionStmtNode) IsRemote() bool

func (*CreateFunctionStmtNode) Language

func (n *CreateFunctionStmtNode) Language() string

func (*CreateFunctionStmtNode) OptionList

func (n *CreateFunctionStmtNode) OptionList() []*OptionNode

func (*CreateFunctionStmtNode) ReturnType

func (n *CreateFunctionStmtNode) ReturnType() types.Type

func (*CreateFunctionStmtNode) SQLSecurity

func (n *CreateFunctionStmtNode) SQLSecurity() SQLSecurity

func (*CreateFunctionStmtNode) SetAggregateExpressionList

func (n *CreateFunctionStmtNode) SetAggregateExpressionList(v []*ComputedColumnNode)

func (*CreateFunctionStmtNode) SetArgumentNameList

func (n *CreateFunctionStmtNode) SetArgumentNameList(v []string)

func (*CreateFunctionStmtNode) SetCode

func (n *CreateFunctionStmtNode) SetCode(v string)

func (*CreateFunctionStmtNode) SetConnection

func (n *CreateFunctionStmtNode) SetConnection(v *ConnectionNode)

func (*CreateFunctionStmtNode) SetDeterminismLevel

func (n *CreateFunctionStmtNode) SetDeterminismLevel(v DeterminismLevel)

func (*CreateFunctionStmtNode) SetFunctionExpression

func (n *CreateFunctionStmtNode) SetFunctionExpression(v ExprNode)

func (*CreateFunctionStmtNode) SetHasExplicitReturnType

func (n *CreateFunctionStmtNode) SetHasExplicitReturnType(v bool)

func (*CreateFunctionStmtNode) SetIsAggregate

func (n *CreateFunctionStmtNode) SetIsAggregate(v bool)

func (*CreateFunctionStmtNode) SetIsRemote

func (n *CreateFunctionStmtNode) SetIsRemote(v bool)

func (*CreateFunctionStmtNode) SetLanguage

func (n *CreateFunctionStmtNode) SetLanguage(v string)

func (*CreateFunctionStmtNode) SetOptionList

func (n *CreateFunctionStmtNode) SetOptionList(v []*OptionNode)

func (*CreateFunctionStmtNode) SetReturnType

func (n *CreateFunctionStmtNode) SetReturnType(v types.Type)

func (*CreateFunctionStmtNode) SetSQLSecurity

func (n *CreateFunctionStmtNode) SetSQLSecurity(v SQLSecurity)

func (*CreateFunctionStmtNode) SetSignature

func (n *CreateFunctionStmtNode) SetSignature(v *types.FunctionSignature)

func (*CreateFunctionStmtNode) Signature

type CreateIndexStmtNode

type CreateIndexStmtNode struct {
	*BaseCreateStatementNode
}

CreateIndexStmtNode this statement: CREATE [OR REPLACE] [UNIQUE] [SEARCH] INDEX [IF NOT EXISTS]

<index_name_path> ON <table_name_path>

[STORING (Expression, ...)] [UNNEST(path_expression) [[AS] alias] [WITH OFFSET [[AS] alias]], ...] (path_expression [ASC|DESC], ...) [OPTIONS (name=value, ...)];

<table_name_path> is the name of table being indexed. <table_scan> is a TableScan on the table being indexed. <is_unique> specifies if the index has unique entries. <is_search> specifies if the index is for search. <index_all_columns> specifies if indexing all the columns of the table.

When this field is true, index_item_list must be
empty and is_search must be true.

<index_item_list> has the columns being indexed, specified as references

to 'computed_columns_list' entries or the columns of
'table_scan'.

<storing_expression_list> has the expressions in the storing clause. <option_list> has engine-specific directives for how and where to

materialize this index.

<computed_columns_list> has computed columns derived from the columns of

'table_scan' or 'unnest_expressions_list'. For
example, the extracted field (e.g., x.y.z).

<unnest_expressions_list> has unnest expressions derived from

'table_scan' or previous unnest expressions in
the list. So the list order is significant.

func (*CreateIndexStmtNode) AddComputedColumn

func (n *CreateIndexStmtNode) AddComputedColumn(v *ComputedColumnNode)

func (*CreateIndexStmtNode) AddIndexItem

func (n *CreateIndexStmtNode) AddIndexItem(v *IndexItemNode)

func (*CreateIndexStmtNode) AddOption

func (n *CreateIndexStmtNode) AddOption(v *OptionNode)

func (*CreateIndexStmtNode) AddStoringExpression

func (n *CreateIndexStmtNode) AddStoringExpression(v ExprNode)

func (*CreateIndexStmtNode) AddTableNamePath

func (n *CreateIndexStmtNode) AddTableNamePath(v string)

func (*CreateIndexStmtNode) AddUnnestExpression

func (n *CreateIndexStmtNode) AddUnnestExpression(v *UnnestItemNode)

func (*CreateIndexStmtNode) ComputedColumnsList

func (n *CreateIndexStmtNode) ComputedColumnsList() []*ComputedColumnNode

func (*CreateIndexStmtNode) IndexAllColumns

func (n *CreateIndexStmtNode) IndexAllColumns() bool

func (*CreateIndexStmtNode) IndexItemList

func (n *CreateIndexStmtNode) IndexItemList() []*IndexItemNode

func (*CreateIndexStmtNode) IsSearch

func (n *CreateIndexStmtNode) IsSearch() bool

func (*CreateIndexStmtNode) IsUnique

func (n *CreateIndexStmtNode) IsUnique() bool

func (*CreateIndexStmtNode) OptionList

func (n *CreateIndexStmtNode) OptionList() []*OptionNode

func (*CreateIndexStmtNode) SetComputedColumnList

func (n *CreateIndexStmtNode) SetComputedColumnList(v []*ComputedColumnNode)

func (*CreateIndexStmtNode) SetIndexAllColumns

func (n *CreateIndexStmtNode) SetIndexAllColumns(v bool)

func (*CreateIndexStmtNode) SetIndexItemList

func (n *CreateIndexStmtNode) SetIndexItemList(v []*IndexItemNode)

func (*CreateIndexStmtNode) SetIsSearch

func (n *CreateIndexStmtNode) SetIsSearch(v bool)

func (*CreateIndexStmtNode) SetIsUnique

func (n *CreateIndexStmtNode) SetIsUnique(v bool)

func (*CreateIndexStmtNode) SetOptionList

func (n *CreateIndexStmtNode) SetOptionList(v []*OptionNode)

func (*CreateIndexStmtNode) SetStoringExpressionList

func (n *CreateIndexStmtNode) SetStoringExpressionList(v []ExprNode)

func (*CreateIndexStmtNode) SetTableNamePath

func (n *CreateIndexStmtNode) SetTableNamePath(v []string)

func (*CreateIndexStmtNode) SetTableScan

func (n *CreateIndexStmtNode) SetTableScan(v *TableScanNode)

func (*CreateIndexStmtNode) SetUnnestExpressionList

func (n *CreateIndexStmtNode) SetUnnestExpressionList(v []*UnnestItemNode)

func (*CreateIndexStmtNode) StoringExpressionList

func (n *CreateIndexStmtNode) StoringExpressionList() []ExprNode

func (*CreateIndexStmtNode) TableNamePath

func (n *CreateIndexStmtNode) TableNamePath() []string

func (*CreateIndexStmtNode) TableScan

func (n *CreateIndexStmtNode) TableScan() *TableScanNode

func (*CreateIndexStmtNode) UnnestExpressionList

func (n *CreateIndexStmtNode) UnnestExpressionList() []*UnnestItemNode

type CreateMaterializedViewStmtNode

type CreateMaterializedViewStmtNode struct {
	*BaseCreateViewNode
}

CreateMaterializedViewStmtNode this statement:

CREATE MATERIALIZED VIEW <name> [(...)] [PARTITION BY expr, ...]
[CLUSTER BY expr, ...] [OPTIONS (...)] AS SELECT ...

<column_definition_list> matches 1:1 with the <output_column_list> in BaseCreateViewNode and provides explicit definition for each Column produced by <query>. Output column names and types must match column definition names and types. If the table is a value table, <column_definition_list> must have exactly one column, with a generated name such as "$struct".

Currently <column_definition_list> contains the same schema information (column names and types) as <output_definition_list>, but when/if we allow specifying column OPTIONS as part of CMV statement, this information will be available only in <column_definition_list>. Therefore, consumers are encouraged to read from <column_definition_list> rather than from <output_column_list> to determine the schema, if possible.

<partition_by_list> specifies the partitioning expressions for the

materialized view.

<cluster_by_list> specifies the clustering expressions for the

materialized view.

func (*CreateMaterializedViewStmtNode) AddClusterBy

func (n *CreateMaterializedViewStmtNode) AddClusterBy(v ExprNode)

func (*CreateMaterializedViewStmtNode) AddColumnDefinition

func (n *CreateMaterializedViewStmtNode) AddColumnDefinition(v *ColumnDefinitionNode)

func (*CreateMaterializedViewStmtNode) AddPartitionBy

func (n *CreateMaterializedViewStmtNode) AddPartitionBy(v ExprNode)

func (*CreateMaterializedViewStmtNode) ClusterByList

func (n *CreateMaterializedViewStmtNode) ClusterByList() []ExprNode

func (*CreateMaterializedViewStmtNode) ColumnDefinitionList

func (n *CreateMaterializedViewStmtNode) ColumnDefinitionList() []*ColumnDefinitionNode

func (*CreateMaterializedViewStmtNode) PartitionByList

func (n *CreateMaterializedViewStmtNode) PartitionByList() []ExprNode

func (*CreateMaterializedViewStmtNode) SetClusterByList

func (n *CreateMaterializedViewStmtNode) SetClusterByList(v []ExprNode)

func (*CreateMaterializedViewStmtNode) SetColumnDefinitionList

func (n *CreateMaterializedViewStmtNode) SetColumnDefinitionList(v []*ColumnDefinitionNode)

func (*CreateMaterializedViewStmtNode) SetPartitionByList

func (n *CreateMaterializedViewStmtNode) SetPartitionByList(v []ExprNode)

type CreateMode

type CreateMode int
const (
	CreateDefaultMode     CreateMode = 0
	CreateOrReplaceMode   CreateMode = 1
	CreateIfNotExistsMode CreateMode = 2
)

type CreateModelStmtNode

type CreateModelStmtNode struct {
	*BaseCreateStatementNode
}

CreateModelStmtNode this statement:

CREATE [TEMP] MODEL <name> [TRANSFORM(...)] [OPTIONS (...)] AS SELECT ..

<option_list> has engine-specific directives for how to train this model. <output_column_list> matches 1:1 with the <query>'s column_list and the

<column_definition_list>, and identifies the names
and types of the columns output from the select
statement.

<query> is the select statement. <transform_input_column_list> introduces new ColumnsNode that have the

same names and types of the columns in the <output_column_list>. The
transform expressions resolve against these ColumnsNode. It's only
set when <transform_list> is non-empty.

<transform_list> is the list of ComputedColumnNode in TRANSFORM

clause.

<transform_output_column_list> matches 1:1 with <transform_list> output.

It records the names of the output columns from TRANSFORM clause.

<transform_analytic_function_group_list> is the list of

AnalyticFunctionGroup for analytic functions inside TRANSFORM clause.
It records the input expression of the analytic functions. It can
see all the columns from <transform_input_column_list>. The only valid
group is for the full, unbounded window generated from empty OVER()
clause.
For example, CREATE MODEL statement
"create model Z
  transform (max(c) over() as d)
  options ()
  as select 1 c, 2 b;"
will generate transform_analytic_function_group_list:
+-transform_analytic_function_group_list=
  +-AnalyticFunctionGroup
    +-analytic_function_list=
      +-d#5 :=
        +-AnalyticFunctionCall(ZetaSQL:max(INT64) -> INT64)
          +-ColumnRef(type=INT64, column=Z.c#3)
          +-window_frame=
            +-WindowFrame(frame_unit=ROWS)
              +-start_expr=
              | +-WindowFrameExpr(boundary_type=UNBOUNDED PRECEDING)
              +-end_expr=
                +-WindowFrameExpr(boundary_type=UNBOUNDED FOLLOWING)

func (*CreateModelStmtNode) AddOption

func (n *CreateModelStmtNode) AddOption(v *OptionNode)

func (*CreateModelStmtNode) AddOutputColumn

func (n *CreateModelStmtNode) AddOutputColumn(v *OutputColumnNode)

func (*CreateModelStmtNode) AddTransform

func (n *CreateModelStmtNode) AddTransform(v *ComputedColumnNode)

func (*CreateModelStmtNode) AddTransformAnalyticFunctionGroup

func (n *CreateModelStmtNode) AddTransformAnalyticFunctionGroup(v *AnalyticFunctionGroupNode)

func (*CreateModelStmtNode) AddTransformInputColumn

func (n *CreateModelStmtNode) AddTransformInputColumn(v *ColumnDefinitionNode)

func (*CreateModelStmtNode) AddTransformOutputColumn

func (n *CreateModelStmtNode) AddTransformOutputColumn(v *OutputColumnNode)

func (*CreateModelStmtNode) OptionList

func (n *CreateModelStmtNode) OptionList() []*OptionNode

func (*CreateModelStmtNode) OutputColumnList

func (n *CreateModelStmtNode) OutputColumnList() []*OutputColumnNode

func (*CreateModelStmtNode) Query

func (n *CreateModelStmtNode) Query() ScanNode

func (*CreateModelStmtNode) SetOptionList

func (n *CreateModelStmtNode) SetOptionList(v []*OptionNode)

func (*CreateModelStmtNode) SetOutputColumnList

func (n *CreateModelStmtNode) SetOutputColumnList(v []*OutputColumnNode)

func (*CreateModelStmtNode) SetQuery

func (n *CreateModelStmtNode) SetQuery(v ScanNode)

func (*CreateModelStmtNode) SetTransformAnalyticFunctionGroupList

func (n *CreateModelStmtNode) SetTransformAnalyticFunctionGroupList(v []*AnalyticFunctionGroupNode)

func (*CreateModelStmtNode) SetTransformInputColumnList

func (n *CreateModelStmtNode) SetTransformInputColumnList(v []*ColumnDefinitionNode)

func (*CreateModelStmtNode) SetTransformList

func (n *CreateModelStmtNode) SetTransformList(v []*ComputedColumnNode)

func (*CreateModelStmtNode) SetTransformOutputColumnList

func (n *CreateModelStmtNode) SetTransformOutputColumnList(v []*OutputColumnNode)

func (*CreateModelStmtNode) TransformAnalyticFunctionGroupList

func (n *CreateModelStmtNode) TransformAnalyticFunctionGroupList() []*AnalyticFunctionGroupNode

func (*CreateModelStmtNode) TransformInputColumnList

func (n *CreateModelStmtNode) TransformInputColumnList() []*ColumnDefinitionNode

func (*CreateModelStmtNode) TransformList

func (n *CreateModelStmtNode) TransformList() []*ComputedColumnNode

func (*CreateModelStmtNode) TransformOutputColumnList

func (n *CreateModelStmtNode) TransformOutputColumnList() []*OutputColumnNode

type CreatePrivilegeRestrictionStmtNode

type CreatePrivilegeRestrictionStmtNode struct {
	*BaseCreateStatementNode
}

CreatePrivilegeRestrictionStmtNode this statement:

CREATE [OR REPLACE] PRIVILEGE RESTRICTION [IF NOT EXISTS]
ON <column_privilege_list> ON <object_type> <name_path>
[RESTRICT TO (<restrictee_list>)]

<column_privilege_list> is the name of the column privileges on which

to apply the restrictions.

<object_type> is a string identifier, which is currently either TABLE or

VIEW, which tells the engine how to look up the name.

<restrictee_list> is a list of users and groups the privilege restrictions

should apply to. Each restrictee is either a string
literal or a parameter.

func (*CreatePrivilegeRestrictionStmtNode) AddColumnPrivilege

func (n *CreatePrivilegeRestrictionStmtNode) AddColumnPrivilege(v *PrivilegeNode)

func (*CreatePrivilegeRestrictionStmtNode) AddRestrictee

func (n *CreatePrivilegeRestrictionStmtNode) AddRestrictee(v ExprNode)

func (*CreatePrivilegeRestrictionStmtNode) ColumnPrivilegeList

func (n *CreatePrivilegeRestrictionStmtNode) ColumnPrivilegeList() []*PrivilegeNode

func (*CreatePrivilegeRestrictionStmtNode) ObjectType

func (*CreatePrivilegeRestrictionStmtNode) RestricteeList

func (n *CreatePrivilegeRestrictionStmtNode) RestricteeList() []ExprNode

func (*CreatePrivilegeRestrictionStmtNode) SetColumnPrivilegeList

func (n *CreatePrivilegeRestrictionStmtNode) SetColumnPrivilegeList(v []*PrivilegeNode)

func (*CreatePrivilegeRestrictionStmtNode) SetObjectType

func (n *CreatePrivilegeRestrictionStmtNode) SetObjectType(v string)

func (*CreatePrivilegeRestrictionStmtNode) SetRestricteeList

func (n *CreatePrivilegeRestrictionStmtNode) SetRestricteeList(v []ExprNode)

type CreateProcedureStmtNode

type CreateProcedureStmtNode struct {
	*BaseCreateStatementNode
}

CreateProcedureStmtNode this statement creates a user-defined procedure: CREATE [OR REPLACE] [TEMP] PROCEDURE [IF NOT EXISTS] <name_path> (<arg_list>) [OPTIONS (<option_list>)] BEGIN <procedure_body> END;

<name_path> is the identifier path of the procedure. <argument_name_list> The names of the function arguments. <signature> is the FunctionSignature of the created procedure, with all

options.  This can be used to create a procedure to load into a
Catalog for future queries.

<option_list> has engine-specific directives for modifying procedures. <procedure_body> is a string literal that contains the procedure body.

It includes everything from the BEGIN keyword to the END keyword,
inclusive.

The resolver will perform some basic validation on the procedure
body, for example, verifying that DECLARE statements are in the
proper position, and that variables are not declared more than
once, but any validation that requires the catalog (including
generating resolved tree nodes for individual statements) is
deferred until the procedure is actually called.  This deferral
makes it possible to define a procedure which references a table
or routine that does not yet exist, so long as the entity is
created before the procedure is called.

func (*CreateProcedureStmtNode) AddArgumentName

func (n *CreateProcedureStmtNode) AddArgumentName(v string)

func (*CreateProcedureStmtNode) AddOption

func (n *CreateProcedureStmtNode) AddOption(v *OptionNode)

func (*CreateProcedureStmtNode) ArgumentNameList

func (n *CreateProcedureStmtNode) ArgumentNameList() []string

func (*CreateProcedureStmtNode) OptionList

func (n *CreateProcedureStmtNode) OptionList() []*OptionNode

func (*CreateProcedureStmtNode) ProcedureBody

func (n *CreateProcedureStmtNode) ProcedureBody() string

func (*CreateProcedureStmtNode) SetArgumentNameList

func (n *CreateProcedureStmtNode) SetArgumentNameList(v []string)

func (*CreateProcedureStmtNode) SetOptionList

func (n *CreateProcedureStmtNode) SetOptionList(v []*OptionNode)

func (*CreateProcedureStmtNode) SetProcedureBody

func (n *CreateProcedureStmtNode) SetProcedureBody(v string)

func (*CreateProcedureStmtNode) SetSignature

func (n *CreateProcedureStmtNode) SetSignature(v *types.FunctionSignature)

func (*CreateProcedureStmtNode) Signature

type CreateRowAccessPolicyStmtNode

type CreateRowAccessPolicyStmtNode struct {
	*BaseStatementNode
}

CreateRowAccessPolicyStmtNode this statement: CREATE [OR REPLACE] ROW ACCESS POLICY [IF NOT EXISTS]

[<name>] ON <target_name_path>
[GRANT TO (<grantee_list>)]
FILTER USING (<predicate>);

<create_mode> indicates if this was CREATE, CREATE OR REPLACE, or

CREATE IF NOT EXISTS.

<name> is the name of the row access policy to be created or an empty

string.

<target_name_path> is a vector giving the identifier path of the target

table.

<table_scan> is a TableScan for the target table, which is used during

resolving and validation. Consumers can use either the table
object inside it or target_name_path to reference the table.

<grantee_list> (DEPRECATED) is the list of user principals the policy

should apply to.

<grantee_expr_list> is the list of user principals the policy should

apply to, and may include parameters.

<predicate> is a boolean expression that selects the rows that are being

made visible.

<predicate_str> is the string form of the predicate.

Only one of <grantee_list> or <grantee_expr_list> will be populated, depending on whether or not the FEATURE_PARAMETERS_IN_GRANTEE_LIST is enabled. The <grantee_list> is deprecated, and will be removed along with the corresponding FEATURE once all engines have migrated to use the <grantee_expr_list>. Once <grantee_expr_list> is the only one, then it should be marked as NOT_IGNORABLE.

func (*CreateRowAccessPolicyStmtNode) AddGrantee

func (n *CreateRowAccessPolicyStmtNode) AddGrantee(v string)

func (*CreateRowAccessPolicyStmtNode) AddGranteeExpr

func (n *CreateRowAccessPolicyStmtNode) AddGranteeExpr(v ExprNode)

func (*CreateRowAccessPolicyStmtNode) AddTargetNamePath

func (n *CreateRowAccessPolicyStmtNode) AddTargetNamePath(v string)

func (*CreateRowAccessPolicyStmtNode) CreateMode

func (n *CreateRowAccessPolicyStmtNode) CreateMode() CreateMode

func (*CreateRowAccessPolicyStmtNode) GranteeExprList

func (n *CreateRowAccessPolicyStmtNode) GranteeExprList() []ExprNode

func (*CreateRowAccessPolicyStmtNode) GranteeList

func (n *CreateRowAccessPolicyStmtNode) GranteeList() []string

func (*CreateRowAccessPolicyStmtNode) Name

func (*CreateRowAccessPolicyStmtNode) Predicate

func (n *CreateRowAccessPolicyStmtNode) Predicate() ExprNode

func (*CreateRowAccessPolicyStmtNode) PredicateStr

func (n *CreateRowAccessPolicyStmtNode) PredicateStr() string

func (*CreateRowAccessPolicyStmtNode) SetCreateMode

func (n *CreateRowAccessPolicyStmtNode) SetCreateMode(v CreateMode)

func (*CreateRowAccessPolicyStmtNode) SetGranteeExprList

func (n *CreateRowAccessPolicyStmtNode) SetGranteeExprList(v []ExprNode)

func (*CreateRowAccessPolicyStmtNode) SetGranteeList

func (n *CreateRowAccessPolicyStmtNode) SetGranteeList(v []string)

func (*CreateRowAccessPolicyStmtNode) SetName

func (n *CreateRowAccessPolicyStmtNode) SetName(v string)

func (*CreateRowAccessPolicyStmtNode) SetPredicate

func (n *CreateRowAccessPolicyStmtNode) SetPredicate(v ExprNode)

func (*CreateRowAccessPolicyStmtNode) SetPredicateStr

func (n *CreateRowAccessPolicyStmtNode) SetPredicateStr(v string)

func (*CreateRowAccessPolicyStmtNode) SetTableScan

func (n *CreateRowAccessPolicyStmtNode) SetTableScan(v *TableScanNode)

func (*CreateRowAccessPolicyStmtNode) SetTargetNamePath

func (n *CreateRowAccessPolicyStmtNode) SetTargetNamePath(v []string)

func (*CreateRowAccessPolicyStmtNode) TableScan

func (*CreateRowAccessPolicyStmtNode) TargetNamePath

func (n *CreateRowAccessPolicyStmtNode) TargetNamePath() []string

type CreateSchemaStmtNode

type CreateSchemaStmtNode struct {
	*BaseCreateStatementNode
}

CreateSchemaStmtNode this statement:

CREATE [OR REPLACE] SCHEMA [IF NOT EXISTS] <name>
[DEFAULT COLLATE <collation>]
[OPTIONS (name=value, ...)]

<option_list> engine-specific options. <collation_name> specifies the default collation specification for future

tables created in the dataset. If a table is created in this dataset
without specifying table-level default collation, it inherits the
dataset default collation. A change to this field affects only tables
created afterwards, not the existing tables. Only string literals
are allowed for this field.

Note: If a table being created in this schema does not specify table
default collation, the engine should copy the dataset default collation
to the table as the table default collation.

func (*CreateSchemaStmtNode) AddOption

func (n *CreateSchemaStmtNode) AddOption(v *OptionNode)

func (*CreateSchemaStmtNode) CollationName

func (n *CreateSchemaStmtNode) CollationName() ExprNode

func (*CreateSchemaStmtNode) OptionList

func (n *CreateSchemaStmtNode) OptionList() []*OptionNode

func (*CreateSchemaStmtNode) SetCollationName

func (n *CreateSchemaStmtNode) SetCollationName(v ExprNode)

func (*CreateSchemaStmtNode) SetOptionList

func (n *CreateSchemaStmtNode) SetOptionList(v []*OptionNode)

type CreateScope

type CreateScope int
const (
	CreateScopeDefault CreateScope = 0
	CreateScopePrivate CreateScope = 1
	CreateScopePublic  CreateScope = 2
	CreateScopeTemp    CreateScope = 3
)

type CreateSnapshotTableStmtNode

type CreateSnapshotTableStmtNode struct {
	*BaseCreateStatementNode
}

CreateSnapshotTableStmtNode this statement:

CREATE SNAPSHOT TABLE [IF NOT EXISTS] <name> [OPTIONS (...)]
CLONE <name>
        [FOR SYSTEM_TIME AS OF <time_expr>]

<clone_from> the source data to clone data from.

ResolvedTableScan will represent the source table, with an
optional for_system_time_expr.
The TableScanNode may be wrapped inside a
FilterScanNode if the source table has a where clause.
No other Scan types are allowed here.
By default, all fields (column names, types, constraints,
partition, clustering, options etc.) will be inherited from
the source table. If table options are explicitly set, the
explicit options will take precedence.
The 'clone_from.column_list' field may be set, but should be ignored.

func (*CreateSnapshotTableStmtNode) AddOption

func (n *CreateSnapshotTableStmtNode) AddOption(v *OptionNode)

func (*CreateSnapshotTableStmtNode) CloneFrom

func (n *CreateSnapshotTableStmtNode) CloneFrom() ScanNode

func (*CreateSnapshotTableStmtNode) OptionList

func (n *CreateSnapshotTableStmtNode) OptionList() []*OptionNode

func (*CreateSnapshotTableStmtNode) SetCloneFrom

func (n *CreateSnapshotTableStmtNode) SetCloneFrom(v ScanNode)

func (*CreateSnapshotTableStmtNode) SetOptionList

func (n *CreateSnapshotTableStmtNode) SetOptionList(v []*OptionNode)

type CreateStatementNode

type CreateStatementNode interface {
	StatementNode
	NamePath() []string
	SetNamePath([]string)
	AddNamePath(string)
	CreateScope() CreateScope
	SetCreateScope(CreateScope)
	CreateMode() CreateMode
	SetCreateMode(CreateMode)
}

CreateStatementNode common base node for CREATE statements with standard modifiers like

CREATE [OR REPLACE] [TEMP|TEMPORARY|PUBLIC|PRIVATE] <object type>
[IF NOT EXISTS] <name> ...

<name_path> is a vector giving the identifier path in the table name. <create_scope> is the relevant scope, i.e., DEFAULT, TEMP, PUBLIC,

or PRIVATE.  PUBLIC/PRIVATE are only valid in module
resolution context.

<create_mode> indicates if this was CREATE, CREATE OR REPLACE, or

CREATE IF NOT EXISTS.

type CreateTableAsSelectStmtNode

type CreateTableAsSelectStmtNode struct {
	*BaseCreateTableStmtNode
}

CreateTableAsSelectStmt this statement:

CREATE [TEMP] TABLE <name> [(column schema, ...) | LIKE <name_path>]
[DEFAULT COLLATE <collation_name>] [PARTITION BY expr, ...]
[CLUSTER BY expr, ...] [OPTIONS (...)]
AS SELECT ...

The <output_column_list> matches 1:1 with the <column_definition_list> in BaseCreateTableStmtNode, and maps ColumnsNode produced by <query> into specific columns of the created table. The output column names and types must match the column definition names and types. If the table is a value table, <output_column_list> must have exactly one column, with a generated name such as "$struct".

<output_column_list> does not contain all table schema information that <column_definition_list> does. For example, NOT NULL annotations, column OPTIONS, and primary keys are only available in <column_definition_list>. Consumers are encouraged to read from <column_definition_list> rather than than <output_column_list> to determine the table schema, if possible.

<query> is the query to run.

func (*CreateTableAsSelectStmtNode) AddClusterBy

func (n *CreateTableAsSelectStmtNode) AddClusterBy(v ExprNode)

func (*CreateTableAsSelectStmtNode) AddOutputColumn

func (n *CreateTableAsSelectStmtNode) AddOutputColumn(v *OutputColumnNode)

func (*CreateTableAsSelectStmtNode) AddPartitionBy

func (n *CreateTableAsSelectStmtNode) AddPartitionBy(v ExprNode)

func (*CreateTableAsSelectStmtNode) ClusterByList

func (n *CreateTableAsSelectStmtNode) ClusterByList() []ExprNode

func (*CreateTableAsSelectStmtNode) OutputColumnList

func (n *CreateTableAsSelectStmtNode) OutputColumnList() []*OutputColumnNode

func (*CreateTableAsSelectStmtNode) PartitionByList

func (n *CreateTableAsSelectStmtNode) PartitionByList() []ExprNode

func (*CreateTableAsSelectStmtNode) Query

func (*CreateTableAsSelectStmtNode) SetClusterByList

func (n *CreateTableAsSelectStmtNode) SetClusterByList(v []ExprNode)

func (*CreateTableAsSelectStmtNode) SetOutputColumnList

func (n *CreateTableAsSelectStmtNode) SetOutputColumnList(v []*OutputColumnNode)

func (*CreateTableAsSelectStmtNode) SetPartitionByList

func (n *CreateTableAsSelectStmtNode) SetPartitionByList(v []ExprNode)

func (*CreateTableAsSelectStmtNode) SetQuery

func (n *CreateTableAsSelectStmtNode) SetQuery(v ScanNode)

type CreateTableFunctionStmtNode

type CreateTableFunctionStmtNode struct {
	*BaseCreateStatementNode
}

CreateTableFunctionStmtNode this statement creates a user-defined table-valued function:

CREATE [TEMP] TABLE FUNCTION [IF NOT EXISTS]
  <name_path> (<argument_name_list>)
  [RETURNS <return_type>]
  [OPTIONS (<option_list>)]
  [LANGUAGE <language>]
  [AS <code> | AS ( <query> )]

<argument_name_list> contains the names of the function arguments.
<signature> is the FunctionSignature of the created function, with all
       options.  This can be used to create a Function to load into a
       Catalog for future queries.
<option_list> has engine-specific directives for modifying functions.
<language> is the programming language used by the function. This field
       is set to 'SQL' for SQL functions, to the language name specified
       in the LANGUAGE clause if present, and to 'UNDECLARED' if both
       the LANGUAGE clause and query are not present.
<code> is an optional string literal that contains the function
       definition.  Some engines may allow this argument to be omitted
       for certain types of external functions.  This will always be set
       for SQL functions.
<query> is the SQL query invoked for the function.  This will be unset
       for external language functions. For non-templated SQL functions,
       this is a resolved representation of the query in <code>.
<output_column_list> is the list of resolved output
       columns returned by the table-valued function.
<is_value_table> If true, this function returns a value table.
       Rather than producing rows with named columns, it produces
       rows with a single unnamed value type. <output_column_list> will
       have exactly one anonymous column (with no name).
       See (broken link).
<sql_security> is the declared security mode for the function. Values
       include 'INVOKER', 'DEFINER'.
<has_explicit_return_schema> is true iff RETURNS clause is present.

---------------------- Table-Valued Functions ----------------------

This is a statement to create a new table-valued function. Each table-valued function returns an entire table as output instead of a single scalar value. Table-valued functions can only be created if LanguageOptions has FEATURE_CREATE_TABLE_FUNCTION enabled.

For SQL table-valued functions that include a defined SQL body, the <query> is non-NULL and contains the resolved SQL body. In this case, <output_column_list> contains a list of the output columns of the SQL body. The <query> uses ArgumentRefNodes to refer to scalar arguments and RelationArgumentScanNodes to refer to relation arguments.

The table-valued function may include RETURNS TABLE<...> to explicitly specify a schema for the output table returned by the function. If the function declaration includes a SQL body, then the names and types of the output columns of the corresponding <query> will have been coerced to exactly match 1:1 with the names and types of the columns specified in the RETURNS TABLE<...> section.

When resolving a query that calls a table-valued function, the query will have a TVFScanNode that invokes the function.

Value tables: If the function declaration includes a value-table parameter, this is written as an argument of type "TABLE" where the table contains a single anonymous column with a type but no name. In this case, calls to the function may pass a (regular or value) table with a single (named or unnamed) column for any of these parameters, and ZetaSQL accepts these arguments as long as the column type matches.

Similarly, if the CREATE TABLE FUNCTION statement includes a "RETURNS TABLE" section with a single column with no name, then this defines a value-table return type. The function then returns a value table as long as the SQL body returns a single column whose type matches (independent of whether the SQL body result is a value table or not, and whether the returned column is named or unnamed).

-------------------------------- Templated Table-Valued Functions --------------------------------

ZetaSQL supports table-valued function declarations with parameters of type ANY TABLE. This type indicates that any schema is valid for tables passed for this parameter. In this case:

  • the IsTemplated() method of the <signature> field returns true,
  • the <output_column_list> field is empty,
  • the <is_value_table> field is set to a default value of false (since ZetaSQL cannot analyze the function body in the presence of templated parameters, it is not possible to detect this property yet),

TODO: Update this description once ZetaSQL supports more types of templated function parameters. Currently only ANY TABLE is supported.

func NewCreateTableFunctionStmtNode added in v0.2.5

func NewCreateTableFunctionStmtNode(
	namePath []string,
	scope CreateScope,
	mode CreateMode,
	argumentNameList []string,
	signature *types.FunctionSignature,
	hasExplicitReturnSchema bool,
	optionList []*OptionNode,
	language string,
	code string,
	query ScanNode,
	outputColumnList []*OutputColumnNode,
	isValueTable bool,
	sqlSecurity SQLSecurity) *CreateTableFunctionStmtNode

func (*CreateTableFunctionStmtNode) AddArgumentName

func (n *CreateTableFunctionStmtNode) AddArgumentName(v string)

func (*CreateTableFunctionStmtNode) AddOption

func (n *CreateTableFunctionStmtNode) AddOption(v *OptionNode)

func (*CreateTableFunctionStmtNode) AddOutputColumn

func (n *CreateTableFunctionStmtNode) AddOutputColumn(v *OutputColumnNode)

func (*CreateTableFunctionStmtNode) ArgumentNameList

func (n *CreateTableFunctionStmtNode) ArgumentNameList() []string

func (*CreateTableFunctionStmtNode) Code

func (*CreateTableFunctionStmtNode) HasExplicitReturnSchema

func (n *CreateTableFunctionStmtNode) HasExplicitReturnSchema() bool

func (*CreateTableFunctionStmtNode) IsValueTable

func (n *CreateTableFunctionStmtNode) IsValueTable() bool

func (*CreateTableFunctionStmtNode) Language

func (n *CreateTableFunctionStmtNode) Language() string

func (*CreateTableFunctionStmtNode) OptionList

func (n *CreateTableFunctionStmtNode) OptionList() []*OptionNode

func (*CreateTableFunctionStmtNode) OutputColumnList

func (n *CreateTableFunctionStmtNode) OutputColumnList() []*OutputColumnNode

func (*CreateTableFunctionStmtNode) Query

func (*CreateTableFunctionStmtNode) SQLSecurity

func (n *CreateTableFunctionStmtNode) SQLSecurity() SQLSecurity

func (*CreateTableFunctionStmtNode) SetArgumentNameList

func (n *CreateTableFunctionStmtNode) SetArgumentNameList(v []string)

func (*CreateTableFunctionStmtNode) SetCode

func (n *CreateTableFunctionStmtNode) SetCode(v string)

func (*CreateTableFunctionStmtNode) SetHasExplicitReturnSchema

func (n *CreateTableFunctionStmtNode) SetHasExplicitReturnSchema(v bool)

func (*CreateTableFunctionStmtNode) SetIsValueTable

func (n *CreateTableFunctionStmtNode) SetIsValueTable(v bool)

func (*CreateTableFunctionStmtNode) SetLanguage

func (n *CreateTableFunctionStmtNode) SetLanguage(v string)

func (*CreateTableFunctionStmtNode) SetOptionList

func (n *CreateTableFunctionStmtNode) SetOptionList(v []*OptionNode)

func (*CreateTableFunctionStmtNode) SetOutputColumnList

func (n *CreateTableFunctionStmtNode) SetOutputColumnList(v []*OutputColumnNode)

func (*CreateTableFunctionStmtNode) SetQuery

func (n *CreateTableFunctionStmtNode) SetQuery(v ScanNode)

func (*CreateTableFunctionStmtNode) SetSQLSecurity

func (n *CreateTableFunctionStmtNode) SetSQLSecurity(v SQLSecurity)

func (*CreateTableFunctionStmtNode) SetSignature

func (*CreateTableFunctionStmtNode) Signature

type CreateTableStmtNode

type CreateTableStmtNode struct {
	*BaseCreateTableStmtNode
}

CreateTableStmtNode this statement:

CREATE [TEMP] TABLE <name>
[(column schema, ...) | LIKE <name_path> |
    {CLONE|COPY} <name_path>
        [FOR SYSTEM_TIME AS OF <time_expr>]
        [WHERE <where_clause>]]
[DEFAULT COLLATE <collation_name>]
[PARTITION BY expr, ...] [CLUSTER BY expr, ...]
[OPTIONS (...)]

One of <clone_from> or <copy_from> can be present for CLONE or COPY.

<clone_from> specifes the data source to clone from (cheap, typically
O(1) operation); while <copy_from> is intended for a full copy.

TableScanNode will represent the source table, with an optional
for_system_time_expr.

The TableScanNode may be wrapped inside a FilterScanNode if the
source table has a where clause. No other Scan types are allowed here.

If the OPTIONS clause is explicitly specified, the option values are
intended to be used for the created or replaced table.
If any OPTION is unspecified, the corresponding option from the source
table will be used instead.

The 'clone_from.column_list' field may be set, but should be ignored.

clone_from and copy_from cannot be value tables.

func (*CreateTableStmtNode) AddClusterBy

func (n *CreateTableStmtNode) AddClusterBy(v ExprNode)

func (*CreateTableStmtNode) AddPartitionBy

func (n *CreateTableStmtNode) AddPartitionBy(v ExprNode)

func (*CreateTableStmtNode) CloneFrom

func (n *CreateTableStmtNode) CloneFrom() ScanNode

func (*CreateTableStmtNode) ClusterByList

func (n *CreateTableStmtNode) ClusterByList() []ExprNode

func (*CreateTableStmtNode) CopyFrom

func (n *CreateTableStmtNode) CopyFrom() ScanNode

func (*CreateTableStmtNode) PartitionByList

func (n *CreateTableStmtNode) PartitionByList() []ExprNode

func (*CreateTableStmtNode) SetCloneFrom

func (n *CreateTableStmtNode) SetCloneFrom(v ScanNode)

func (*CreateTableStmtNode) SetClusterByList

func (n *CreateTableStmtNode) SetClusterByList(v []ExprNode)

func (*CreateTableStmtNode) SetCopyFrom

func (n *CreateTableStmtNode) SetCopyFrom(v ScanNode)

func (*CreateTableStmtNode) SetPartitionByList

func (n *CreateTableStmtNode) SetPartitionByList(v []ExprNode)

type CreateViewStmtNode

type CreateViewStmtNode struct {
	*BaseCreateViewNode
}

CreateViewStmtNode this statement: CREATE [TEMP] VIEW <name> [(...)] [OPTIONS (...)] AS SELECT ...

type DMLDefaultNode

type DMLDefaultNode struct {
	*BaseExprNode
}

DMLDefaultNode represents the value DEFAULT that shows up (in place of a value expression) in INSERT and UPDATE statements. For columns, engines should substitute the engine-defined default value for that column, or give an error. For proto fields, this always means to clear the field. This will never show up inside expressions other than DMLValueNode.

type DMLValueNode

type DMLValueNode struct {
	*BaseArgumentNode
}

DMLValueNode represents a value inside an INSERT or UPDATE statement.

The <value> is either an expression or a DMLDefault.

For proto fields, NULL values mean the field should be cleared.

func (*DMLValueNode) SetValue

func (n *DMLValueNode) SetValue(v ExprNode)

func (*DMLValueNode) Value

func (n *DMLValueNode) Value() ExprNode

type DefineTableStmtNode

type DefineTableStmtNode struct {
	*BaseStatementNode
}

DefineTableStmtNode this statement: DEFINE TABLE name (...);

<name_path> is a vector giving the identifier path in the table name. <option_list> has engine-specific options of how the table is defined.

DEFINE TABLE normally has the same effect as CREATE TEMP EXTERNAL TABLE.

func (*DefineTableStmtNode) AddNamePath

func (n *DefineTableStmtNode) AddNamePath(v string)

func (*DefineTableStmtNode) AddOption

func (n *DefineTableStmtNode) AddOption(v *OptionNode)

func (*DefineTableStmtNode) NamePath

func (n *DefineTableStmtNode) NamePath() []string

func (*DefineTableStmtNode) OptionList

func (n *DefineTableStmtNode) OptionList() []*OptionNode

func (*DefineTableStmtNode) SetNamePath

func (n *DefineTableStmtNode) SetNamePath(v []string)

func (*DefineTableStmtNode) SetOptionList

func (n *DefineTableStmtNode) SetOptionList(v []*OptionNode)

type DeleteStmtNode

type DeleteStmtNode struct {
	*BaseStatementNode
}

DeleteStmtNode represents a DELETE statement or a nested DELETE inside an UPDATE statement.

For top-level DELETE statements, <table_scan> gives the table to scan and creates Columns for its columns. Those columns can be referenced inside the <where_expr>.

For nested DELETEs, there is no <table_scan>. The <where_expr> can only reference:

(1) the element_column from the UpdateItemNode containing this
    statement,
(2) columns from the outer statements, and
(3) (optionally) <array_offset_column>, which represents the 0-based
    offset of the array element being modified.

<where_expr> is required.

If <returning> is present, the DELETE statement will return deleted rows back. It can only occur on top-level statements.

This returning clause has a <output_column_list> to represent the data sent back to clients. It can only acccess columns from the <table_scan>.

func (*DeleteStmtNode) ArrayOffsetColumn

func (n *DeleteStmtNode) ArrayOffsetColumn() *ColumnHolderNode

func (*DeleteStmtNode) AssertRowsModified

func (n *DeleteStmtNode) AssertRowsModified() *AssertRowsModifiedNode

func (*DeleteStmtNode) Returning

func (n *DeleteStmtNode) Returning() *ReturningClauseNode

func (*DeleteStmtNode) SetArrayOffsetColumn

func (n *DeleteStmtNode) SetArrayOffsetColumn(v *ColumnHolderNode)

func (*DeleteStmtNode) SetAssertRowsModified

func (n *DeleteStmtNode) SetAssertRowsModified(v *AssertRowsModifiedNode)

func (*DeleteStmtNode) SetReturning

func (n *DeleteStmtNode) SetReturning(v *ReturningClauseNode)

func (*DeleteStmtNode) SetTableScan

func (n *DeleteStmtNode) SetTableScan(v *TableScanNode)

func (*DeleteStmtNode) SetWhereExpr

func (n *DeleteStmtNode) SetWhereExpr(v ExprNode)

func (*DeleteStmtNode) TableScan

func (n *DeleteStmtNode) TableScan() *TableScanNode

func (*DeleteStmtNode) WhereExpr

func (n *DeleteStmtNode) WhereExpr() ExprNode

type DescribeStmtNode

type DescribeStmtNode struct {
	*BaseStatementNode
}

DescribeStmtNode this statement: DESCRIBE [<object_type>] <name> [FROM <from_name_path>];

<object_type> is an optional string identifier,

e.g., "INDEX", "FUNCTION", "TYPE", etc.

<name_path> is a vector giving the identifier path for the object to be described. <from_name_path> is an optional vector giving the identifier path of a

containing object, e.g. a table.

func (*DescribeStmtNode) AddFromNamePath

func (n *DescribeStmtNode) AddFromNamePath(v string)

func (*DescribeStmtNode) AddNamePath

func (n *DescribeStmtNode) AddNamePath(v string)

func (*DescribeStmtNode) FromNamePath

func (n *DescribeStmtNode) FromNamePath() []string

func (*DescribeStmtNode) NamePath

func (n *DescribeStmtNode) NamePath() []string

func (*DescribeStmtNode) ObjectType

func (n *DescribeStmtNode) ObjectType() string

func (*DescribeStmtNode) SetFromNamePath

func (n *DescribeStmtNode) SetFromNamePath(v []string)

func (*DescribeStmtNode) SetNamePath

func (n *DescribeStmtNode) SetNamePath(v []string)

func (*DescribeStmtNode) SetObjectType

func (n *DescribeStmtNode) SetObjectType(v string)

type DescriptorNode

type DescriptorNode struct {
	*BaseArgumentNode
}

DescriptorNode represents a descriptor object as a TVF argument. A descriptor is basically a list of unresolved column names, written

DESCRIPTOR(column1, column2)

<descriptor_column_name_list> contains the column names.

If FunctionArgumentTypeOptions.ResolveDescriptorNamesTableOffset() is true, then <descriptor_column_list> contains resolved columns from the sibling FunctionArgumentNode of scan type, and will match positionally with <descriptor_column_name_list>.

func (*DescriptorNode) AddDescriptorColumn

func (n *DescriptorNode) AddDescriptorColumn(v *Column)

func (*DescriptorNode) AddDescriptorColumnName

func (n *DescriptorNode) AddDescriptorColumnName(v string)

func (*DescriptorNode) DescriptorColumnList

func (n *DescriptorNode) DescriptorColumnList() []*Column

func (*DescriptorNode) DescriptorColumnNameList

func (n *DescriptorNode) DescriptorColumnNameList() []string

func (*DescriptorNode) SetDescriptorColumnList

func (n *DescriptorNode) SetDescriptorColumnList(v []*Column)

func (*DescriptorNode) SetDescriptorColumnNameList

func (n *DescriptorNode) SetDescriptorColumnNameList(v []string)

type DeterminismLevel

type DeterminismLevel int
const (
	DeterminismUnspecified      DeterminismLevel = 0
	DeterminismDeterministic    DeterminismLevel = 1
	DeterminismNotDeterministic DeterminismLevel = 2
	DeterminismImmutable        DeterminismLevel = 3
	DeterminismStable           DeterminismLevel = 4
	DeterminismVolatile         DeterminismLevel = 5
)

type DropColumnActionNode

type DropColumnActionNode struct {
	*BaseAlterActionNode
}

DropColumnActionNode DROP COLUMN action for ALTER TABLE statement

<name> is the name of the column to drop.

func (*DropColumnActionNode) IsIfExists

func (n *DropColumnActionNode) IsIfExists() bool

func (*DropColumnActionNode) Name

func (n *DropColumnActionNode) Name() string

func (*DropColumnActionNode) SetIsIfExists

func (n *DropColumnActionNode) SetIsIfExists(v bool)

func (*DropColumnActionNode) SetName

func (n *DropColumnActionNode) SetName(v string)

type DropConstraintActionNode

type DropConstraintActionNode struct {
	*BaseAlterActionNode
}

DropConstraintActionNode DROP CONSTRAINT for ALTER TABLE statement.

func (*DropConstraintActionNode) IsIfExists

func (n *DropConstraintActionNode) IsIfExists() bool

func (*DropConstraintActionNode) Name

func (n *DropConstraintActionNode) Name() string

func (*DropConstraintActionNode) SetIsIfExists

func (n *DropConstraintActionNode) SetIsIfExists(v bool)

func (*DropConstraintActionNode) SetName

func (n *DropConstraintActionNode) SetName(v string)

type DropFunctionStmtNode

type DropFunctionStmtNode struct {
	*BaseStatementNode
}

DropFunctionStmtNode this statement: DROP FUNCTION [IF EXISTS] <name_path>

[ (<arguments>) ];

<is_if_exists> silently ignore the "name_path does not exist" error. <name_path> is the identifier path of the function to be dropped. <arguments> is an optional list of parameters. If given, each parameter

may consist of a type, or a name and a type.  The name is
disregarded, and is allowed to permit copy-paste from CREATE
FUNCTION statements.

<signature> is the signature of the dropped function. Argument names and

argument options are ignored because only the types matter
for matching signatures in DROP FUNCTION.  The return type
in this signature will always be <void>, since return type
is ignored when matching signatures for DROP.
TODO <arguments> could be deprecated in favor of this.

func (*DropFunctionStmtNode) AddNamePath

func (n *DropFunctionStmtNode) AddNamePath(v string)

func (*DropFunctionStmtNode) Arguments

func (n *DropFunctionStmtNode) Arguments() *ArgumentListNode

Arguments NOTE: arguments for DROP FUNCTION statements are matched only on type; names for any arguments in ResolvedArgumentList will be set to the empty string irrespective of whether or not argument names were given in the DROP FUNCTION statement.

func (*DropFunctionStmtNode) IsIfExists

func (n *DropFunctionStmtNode) IsIfExists() bool

func (*DropFunctionStmtNode) NamePath

func (n *DropFunctionStmtNode) NamePath() []string

func (*DropFunctionStmtNode) SetArguments

func (n *DropFunctionStmtNode) SetArguments(v *ArgumentListNode)

func (*DropFunctionStmtNode) SetIsIfExists

func (n *DropFunctionStmtNode) SetIsIfExists(v bool)

func (*DropFunctionStmtNode) SetNamePath

func (n *DropFunctionStmtNode) SetNamePath(v []string)

func (*DropFunctionStmtNode) SetSignature

func (*DropFunctionStmtNode) Signature

Signature NOTE: arguments for DROP FUNCTION statements are matched only on type; names are irrelevant, so no argument names are saved to use with this signature. Additionally, the return type will always be <void>, since return types are ignored for DROP FUNCTION.

type DropMaterializedViewStmtNode

type DropMaterializedViewStmtNode struct {
	*BaseStatementNode
}

DropMaterializedViewStmtNode this statement: DROP MATERIALIZED VIEW [IF EXISTS] <name_path>;

<name_path> is a vector giving the identifier path for the object to be dropped. <is_if_exists> silently ignore the "name_path does not exist" error.

func (*DropMaterializedViewStmtNode) AddNamePath

func (n *DropMaterializedViewStmtNode) AddNamePath(v string)

func (*DropMaterializedViewStmtNode) IsIfExists

func (n *DropMaterializedViewStmtNode) IsIfExists() bool

func (*DropMaterializedViewStmtNode) NamePath

func (n *DropMaterializedViewStmtNode) NamePath() []string

func (*DropMaterializedViewStmtNode) SetIsIfExists

func (n *DropMaterializedViewStmtNode) SetIsIfExists(v bool)

func (*DropMaterializedViewStmtNode) SetNamePath

func (n *DropMaterializedViewStmtNode) SetNamePath(v []string)

type DropMode

type DropMode int
const (
	DropModeUnspecified DropMode = 0
	DropModeRestrict    DropMode = 1
	DropModeCascade     DropMode = 2
)

type DropPrimaryKeyActionNode

type DropPrimaryKeyActionNode struct {
	*BaseAlterActionNode
}

DropPrimaryKeyActionNode DROP PRIMARY KEY [IF EXISTS] for ALTER TABLE statement.

func (*DropPrimaryKeyActionNode) IsIfExists

func (n *DropPrimaryKeyActionNode) IsIfExists() bool

func (*DropPrimaryKeyActionNode) SetIsIfExists

func (n *DropPrimaryKeyActionNode) SetIsIfExists(v bool)

type DropPrivilegeRestrictionStmtNode

type DropPrivilegeRestrictionStmtNode struct {
	*BaseStatementNode
}

DropPrivilegeRestrictionStmtNode this statement:

DROP PRIVILEGE RESTRICTION [IF EXISTS]
ON <column_privilege_list> ON <object_type> <name_path>

<column_privilege_list> is the name of the column privileges on which

the restrictions have been applied.

<object_type> is a string identifier, which is currently either TABLE or

VIEW, which tells the engine how to look up the name.

<name_path> is the name of the table the restrictions are scoped to.

func (*DropPrivilegeRestrictionStmtNode) AddColumnPrivilege

func (n *DropPrivilegeRestrictionStmtNode) AddColumnPrivilege(v *PrivilegeNode)

func (*DropPrivilegeRestrictionStmtNode) AddNamePath

func (n *DropPrivilegeRestrictionStmtNode) AddNamePath(v string)

func (*DropPrivilegeRestrictionStmtNode) ColumnPrivilegeList

func (n *DropPrivilegeRestrictionStmtNode) ColumnPrivilegeList() []*PrivilegeNode

func (*DropPrivilegeRestrictionStmtNode) IsIfExists

func (n *DropPrivilegeRestrictionStmtNode) IsIfExists() bool

func (*DropPrivilegeRestrictionStmtNode) NamePath

func (n *DropPrivilegeRestrictionStmtNode) NamePath() []string

func (*DropPrivilegeRestrictionStmtNode) ObjectType

func (n *DropPrivilegeRestrictionStmtNode) ObjectType() string

func (*DropPrivilegeRestrictionStmtNode) SetColumnPrivilegeList

func (n *DropPrivilegeRestrictionStmtNode) SetColumnPrivilegeList(v []*PrivilegeNode)

func (*DropPrivilegeRestrictionStmtNode) SetIsIfExists

func (n *DropPrivilegeRestrictionStmtNode) SetIsIfExists(v bool)

func (*DropPrivilegeRestrictionStmtNode) SetNamePath

func (n *DropPrivilegeRestrictionStmtNode) SetNamePath(v []string)

func (*DropPrivilegeRestrictionStmtNode) SetObjectType

func (n *DropPrivilegeRestrictionStmtNode) SetObjectType(v string)

type DropRowAccessPolicyStmtNode

type DropRowAccessPolicyStmtNode struct {
	*BaseStatementNode
}

DropRowAccessPolicyStmtNode this statement:

DROP ROW ACCESS POLICY <name> ON <target_name_path>; or
DROP ALL ROW [ACCESS] POLICIES ON <target_name_path>;

<is_drop_all> indicates that all policies should be dropped. <is_if_exists> silently ignore the "policy <name> does not exist" error.

This is not allowed if is_drop_all is true.

<name> is the name of the row policy to be dropped or an empty string. <target_name_path> is a vector giving the identifier path of the target table.

func (*DropRowAccessPolicyStmtNode) AddTargetNamePath

func (n *DropRowAccessPolicyStmtNode) AddTargetNamePath(v string)

func (*DropRowAccessPolicyStmtNode) IsDropAll

func (n *DropRowAccessPolicyStmtNode) IsDropAll() bool

func (*DropRowAccessPolicyStmtNode) IsIfExists

func (n *DropRowAccessPolicyStmtNode) IsIfExists() bool

func (*DropRowAccessPolicyStmtNode) Name

func (*DropRowAccessPolicyStmtNode) SetIsDropAll

func (n *DropRowAccessPolicyStmtNode) SetIsDropAll(v bool)

func (*DropRowAccessPolicyStmtNode) SetIsIfExists

func (n *DropRowAccessPolicyStmtNode) SetIsIfExists(v bool)

func (*DropRowAccessPolicyStmtNode) SetName

func (n *DropRowAccessPolicyStmtNode) SetName(v string)

func (*DropRowAccessPolicyStmtNode) SetTargetNamePath

func (n *DropRowAccessPolicyStmtNode) SetTargetNamePath(v []string)

func (*DropRowAccessPolicyStmtNode) TargetNamePath

func (n *DropRowAccessPolicyStmtNode) TargetNamePath() []string

type DropSearchIndexStmtNode

type DropSearchIndexStmtNode struct {
	*BaseStatementNode
}

DropSearchIndexStmtNode DROP SEARCH INDEX [IF EXISTS] <name> [ON <table_name_path>];

<name> is the name of the search index to be dropped. <table_name_path> is a vector giving the identifier path of the target table.

func (*DropSearchIndexStmtNode) AddTableNamePath

func (n *DropSearchIndexStmtNode) AddTableNamePath(v string)

func (*DropSearchIndexStmtNode) IsIfExists

func (n *DropSearchIndexStmtNode) IsIfExists() bool

func (*DropSearchIndexStmtNode) Name

func (n *DropSearchIndexStmtNode) Name() string

func (*DropSearchIndexStmtNode) SetIsIfExists

func (n *DropSearchIndexStmtNode) SetIsIfExists(v bool)

func (*DropSearchIndexStmtNode) SetName

func (n *DropSearchIndexStmtNode) SetName(v string)

func (*DropSearchIndexStmtNode) SetTableNamePath

func (n *DropSearchIndexStmtNode) SetTableNamePath(v []string)

func (*DropSearchIndexStmtNode) TableNamePath

func (n *DropSearchIndexStmtNode) TableNamePath() []string

type DropSnapshotTableStmtNode

type DropSnapshotTableStmtNode struct {
	*BaseStatementNode
}

DropSnapshotTableStmtNode this statement: DROP SNAPSHOT TABLE [IF EXISTS] <name_path>;

<name_path> is a vector giving the identifier path for the object to be dropped. <is_if_exists> silently ignore the "name_path does not exist" error.

func (*DropSnapshotTableStmtNode) AddNamePath

func (n *DropSnapshotTableStmtNode) AddNamePath(v string)

func (*DropSnapshotTableStmtNode) IsIfExists

func (n *DropSnapshotTableStmtNode) IsIfExists() bool

func (*DropSnapshotTableStmtNode) NamePath

func (n *DropSnapshotTableStmtNode) NamePath() []string

func (*DropSnapshotTableStmtNode) SetIsIfExists

func (n *DropSnapshotTableStmtNode) SetIsIfExists(v bool)

func (*DropSnapshotTableStmtNode) SetNamePath

func (n *DropSnapshotTableStmtNode) SetNamePath(v []string)

type DropStmtNode

type DropStmtNode struct {
	*BaseStatementNode
}

DropStmtNode this statement: DROP <object_type> [IF EXISTS] <name_path> [<drop_mode>];

<object_type> is an string identifier,

e.g., "TABLE", "VIEW", "INDEX", "FUNCTION", "TYPE", etc.

<name_path> is a vector giving the identifier path for the object to be dropped. <is_if_exists> silently ignore the "name_path does not exist" error. <drop_mode> specifies drop mode RESTRICT/CASCASE, if any.

func (*DropStmtNode) AddNamePath

func (n *DropStmtNode) AddNamePath(v string)

func (*DropStmtNode) DropMode

func (n *DropStmtNode) DropMode() DropMode

func (*DropStmtNode) IsIfExists

func (n *DropStmtNode) IsIfExists() bool

func (*DropStmtNode) NamePath

func (n *DropStmtNode) NamePath() []string

func (*DropStmtNode) ObjectType

func (n *DropStmtNode) ObjectType() string

func (*DropStmtNode) SetDropMode

func (n *DropStmtNode) SetDropMode(v DropMode)

func (*DropStmtNode) SetIsIfExists

func (n *DropStmtNode) SetIsIfExists(v bool)

func (*DropStmtNode) SetNamePath

func (n *DropStmtNode) SetNamePath(v []string)

func (*DropStmtNode) SetObjectType

func (n *DropStmtNode) SetObjectType(v string)

type DropTableFunctionStmtNode

type DropTableFunctionStmtNode struct {
	*BaseStatementNode
}

DropTableFunctionStmtNode this statement: DROP TABLE FUNCTION [IF EXISTS] <name_path>;

<is_if_exists> silently ignore the "name_path does not exist" error. <name_path> is the identifier path of the function to be dropped.

func (*DropTableFunctionStmtNode) AddNamePath

func (n *DropTableFunctionStmtNode) AddNamePath(v string)

func (*DropTableFunctionStmtNode) IsIfExists

func (n *DropTableFunctionStmtNode) IsIfExists() bool

func (*DropTableFunctionStmtNode) NamePath

func (n *DropTableFunctionStmtNode) NamePath() []string

func (*DropTableFunctionStmtNode) SetIsIfExists

func (n *DropTableFunctionStmtNode) SetIsIfExists(v bool)

func (*DropTableFunctionStmtNode) SetNamePath

func (n *DropTableFunctionStmtNode) SetNamePath(v []string)

type ErrorMode

type ErrorMode int
const (
	DefaultErrorMode ErrorMode = 0
	SafeErrorMode    ErrorMode = 1
)

type ExecuteImmediateArgumentNode

type ExecuteImmediateArgumentNode struct {
	*BaseArgumentNode
}

ExecuteImmediateArgumentNode an argument for an EXECUTE IMMEDIATE's USING clause.

<name> an optional name for this expression <expression> the expression's value

func (*ExecuteImmediateArgumentNode) Expression

func (n *ExecuteImmediateArgumentNode) Expression() ExprNode

func (*ExecuteImmediateArgumentNode) Name

func (*ExecuteImmediateArgumentNode) SetExpression

func (n *ExecuteImmediateArgumentNode) SetExpression(v ExprNode)

func (*ExecuteImmediateArgumentNode) SetName

func (n *ExecuteImmediateArgumentNode) SetName(v string)

type ExecuteImmediateStmtNode

type ExecuteImmediateStmtNode struct {
	*BaseStatementNode
}

ExecuteImmediateStmtNode an EXECUTE IMMEDIATE statement EXECUTE IMMEDIATE <sql> [<into_clause>] [<using_clause>]

<sql> a string expression indicating a SQL statement to be dynamically

executed

<into_identifier_list> the identifiers whose values should be set.

Identifiers should not be repeated in the list.

<using_argument_list> a list of arguments to supply for dynamic SQL.

The arguments should either be all named or all unnamed, and
arguments should not be repeated in the list.

func (*ExecuteImmediateStmtNode) AddIntoIdentifier

func (n *ExecuteImmediateStmtNode) AddIntoIdentifier(v string)

func (*ExecuteImmediateStmtNode) AddUsingArgument

func (*ExecuteImmediateStmtNode) IntoIdentifierList

func (n *ExecuteImmediateStmtNode) IntoIdentifierList() []string

func (*ExecuteImmediateStmtNode) SQL

func (*ExecuteImmediateStmtNode) SetIntoIdentifierList

func (n *ExecuteImmediateStmtNode) SetIntoIdentifierList(v []string)

func (*ExecuteImmediateStmtNode) SetSQL

func (n *ExecuteImmediateStmtNode) SetSQL(v string)

func (*ExecuteImmediateStmtNode) SetUsingArgumentList

func (n *ExecuteImmediateStmtNode) SetUsingArgumentList(v []*ExecuteImmediateArgumentNode)

func (*ExecuteImmediateStmtNode) UsingArgumentList

func (n *ExecuteImmediateStmtNode) UsingArgumentList() []*ExecuteImmediateArgumentNode

type ExplainStmtNode

type ExplainStmtNode struct {
	*BaseStatementNode
}

ExplainStmtNode an Explain statement. This is always the root of a statement hierarchy. Its child may be any statement type except another ExplainStmtNode.

It is implementation dependent what action a back end system takes for an ExplainStatement.

func (*ExplainStmtNode) SetStatement

func (n *ExplainStmtNode) SetStatement(v StatementNode)

func (*ExplainStmtNode) Statement

func (n *ExplainStmtNode) Statement() StatementNode

type ExportDataStmtNode

type ExportDataStmtNode struct {
	*BaseStatementNode
}

ExportDataStmtNode this statement:

EXPORT DATA [WITH CONNECTION] <connection> (<option_list>) AS SELECT ...

which is used to run a query and export its result somewhere without giving the result a table name. <connection> connection reference for accessing destination source. <option_list> has engine-specific directives for how and where to

materialize the query result.

<output_column_list> has the names and types of the columns produced by

the query, and maps from <query>'s column_list
to these output columns.  The engine may ignore
the column names depending on the output format.

<query> is the query to run.

The query must produce named columns with unique names.

func (*ExportDataStmtNode) AddOption

func (n *ExportDataStmtNode) AddOption(v *OptionNode)

func (*ExportDataStmtNode) AddOutputColumn

func (n *ExportDataStmtNode) AddOutputColumn(v *OutputColumnNode)

func (*ExportDataStmtNode) Connection

func (n *ExportDataStmtNode) Connection() *ConnectionNode

func (*ExportDataStmtNode) IsValueTable

func (n *ExportDataStmtNode) IsValueTable() bool

IsValueTable if true, the result of this query is a value table. Rather than producing rows with named columns, it produces rows with a single unnamed value type. output_column_list will have exactly one column, with an empty name.

func (*ExportDataStmtNode) OptionList

func (n *ExportDataStmtNode) OptionList() []*OptionNode

func (*ExportDataStmtNode) OutputColumnList

func (n *ExportDataStmtNode) OutputColumnList() []*OutputColumnNode

func (*ExportDataStmtNode) Query

func (n *ExportDataStmtNode) Query() ScanNode

func (*ExportDataStmtNode) SetConnection

func (n *ExportDataStmtNode) SetConnection(v *ConnectionNode)

func (*ExportDataStmtNode) SetIsValueTable

func (n *ExportDataStmtNode) SetIsValueTable(v bool)

func (*ExportDataStmtNode) SetOptionList

func (n *ExportDataStmtNode) SetOptionList(v []*OptionNode)

func (*ExportDataStmtNode) SetOutputColumnList

func (n *ExportDataStmtNode) SetOutputColumnList(v []*OutputColumnNode)

func (*ExportDataStmtNode) SetQuery

func (n *ExportDataStmtNode) SetQuery(v ScanNode)

type ExportModelStmtNode

type ExportModelStmtNode struct {
	*BaseStatementNode
}

ExportModelStmtNode this statement:

EXPORT MODEL <model_name_path> [WITH CONNECTION <connection>]
<option_list>

which is used to export a model to a specific location. <connection> is the connection that the model is written to. <option_list> identifies user specified options to use when exporting the model.

func (*ExportModelStmtNode) AddModelNamePath

func (n *ExportModelStmtNode) AddModelNamePath(v string)

func (*ExportModelStmtNode) AddOption

func (n *ExportModelStmtNode) AddOption(v *OptionNode)

func (*ExportModelStmtNode) Connection

func (n *ExportModelStmtNode) Connection() *ConnectionNode

func (*ExportModelStmtNode) ModelNamePath

func (n *ExportModelStmtNode) ModelNamePath() []string

func (*ExportModelStmtNode) OptionList

func (n *ExportModelStmtNode) OptionList() []*OptionNode

func (*ExportModelStmtNode) SetConnection

func (n *ExportModelStmtNode) SetConnection(v *ConnectionNode)

func (*ExportModelStmtNode) SetModelNamePath

func (n *ExportModelStmtNode) SetModelNamePath(v []string)

func (*ExportModelStmtNode) SetOptionList

func (n *ExportModelStmtNode) SetOptionList(v []*OptionNode)

type ExprNode

type ExprNode interface {
	Node
	//AnnotatedType() *types.AnnotatedType
	Type() types.Type
	SetType(types.Type)
	TypeAnnotationMap() types.AnnotationMap
	SetTypeAnnotationMap(types.AnnotationMap)
}

type ExpressionColumnNode

type ExpressionColumnNode struct {
	*BaseExprNode
}

ExpressionColumnNode represents a column when analyzing a standalone expression. This is only used when the analyzer was called using AnalyzeExpression. Expression column names and types come from (*AnalyzerOptions).AddExpressionColumn. Name() will always be in lowercase.

func (*ExpressionColumnNode) Name

func (n *ExpressionColumnNode) Name() string

func (*ExpressionColumnNode) SetName

func (n *ExpressionColumnNode) SetName(v string)

type ExtendedCastElementNode

type ExtendedCastElementNode struct {
	*BaseArgumentNode
}

ExtendedCastElementNode describes a leaf extended cast of ExtendedCastNode. See the comment for ElementList field of ExtendedCastNode for more details.

func (*ExtendedCastElementNode) FromType

func (n *ExtendedCastElementNode) FromType() types.Type

func (*ExtendedCastElementNode) Function

func (n *ExtendedCastElementNode) Function() *types.Function

func (*ExtendedCastElementNode) SetFromType

func (n *ExtendedCastElementNode) SetFromType(v types.Type)

func (*ExtendedCastElementNode) SetFunction

func (n *ExtendedCastElementNode) SetFunction(v *types.Function)

func (*ExtendedCastElementNode) SetToType

func (n *ExtendedCastElementNode) SetToType(v types.Type)

func (*ExtendedCastElementNode) ToType

func (n *ExtendedCastElementNode) ToType() types.Type

type ExtendedCastNode

type ExtendedCastNode struct {
	*BaseArgumentNode
}

ExtendedCastNode describes overall cast operation between two values where at least one value's type is or contains an extended type (e.g. on a struct field).

func (*ExtendedCastNode) AddElement

func (n *ExtendedCastNode) AddElement(v *ExtendedCastElementNode)

func (*ExtendedCastNode) ElementList

func (n *ExtendedCastNode) ElementList() []*ExtendedCastElementNode

ElementList stores the list of leaf extended casts required as elements of this cast. Each element is a cast where at least one of the input or output is an extended type. For structs or arrays, the elements will be casts for the field or element types. For structs, there can be multiple cast elements (one for each distinct pair of field types). For non-struct types, there will be just a single element.

func (*ExtendedCastNode) SetElementList

func (n *ExtendedCastNode) SetElementList(v []*ExtendedCastElementNode)

type FieldFormat

type FieldFormat int
const (
	DefaultFormat            FieldFormat = 0
	DateFormat               FieldFormat = 1
	TimestampSecondsFormat   FieldFormat = 2
	TimestampMillisFormat    FieldFormat = 3
	TimestampMicrosFormat    FieldFormat = 4
	TimestampNanosFormat     FieldFormat = 5
	DateDecimalFormat        FieldFormat = 6
	TimeMicros               FieldFormat = 7
	DatetimeMicrosFormat     FieldFormat = 8
	StGeographyEncodedFormat FieldFormat = 9
	NumericFormat            FieldFormat = 10
	BigNumericFormat         FieldFormat = 11
	JsonFormat               FieldFormat = 12
	IntervalFormat           FieldFormat = 14
)

type FilterFieldArgNode

type FilterFieldArgNode struct {
	*BaseArgumentNode
}

FilterFieldArgNode an argument to the FILTER_FIELDS() function which specifies a sign to show inclusion/exclusion status and a field path to include or exclude.

func (*FilterFieldArgNode) Include

func (n *FilterFieldArgNode) Include() bool

Include true if we want to include this proto path in the resulting proto (though we may still remove paths below it). If false, we will remove this path (but may still include paths below it).

func (*FilterFieldArgNode) SetInclude

func (n *FilterFieldArgNode) SetInclude(v bool)

type FilterFieldNode

type FilterFieldNode struct {
	*BaseExprNode
}

FilterFieldNode represents a call to the FILTER_FIELDS() function. This function can be used to modify a proto, prune fields and output the resulting proto. The SQL syntax for this function is

FILTER_FIELDS(<expr>, <filter_field_arg_list>).

<expr> must have proto type. <filter_field_arg> contains a sign ('+' or '-') and a field path starting from the proto.

For example:

FILTER_FIELDS(proto, +field1, -field1.field2)

means the resulting proto only contains field1.* except field1.field2.*.

Field paths are evaluated and processed in order, ```

IF filter_field_arg_list[0].include:
  CLEAR all fields
FOR filter_field_arg IN filter_field_arg_list:
  IF filter_field_arg.include:
    UNCLEAR filter_field_arg.field_descriptor_path (and all children)
  ELSE:
    CLEAR filter_field_arg.field_descriptor_path (and all children)

```

The order of field_field args have following constraints:

  1. There must be at least one filter_field arg.
  2. Args for ancestor fields must precede descendants.
  3. Each arg must have opposite `include` compared to the last preceding ancestor field.

func (*FilterFieldNode) AddFilterFieldArg

func (n *FilterFieldNode) AddFilterFieldArg(v *FilterFieldArgNode)

func (*FilterFieldNode) Expr

func (n *FilterFieldNode) Expr() ExprNode

Expr the proto to modify.

func (*FilterFieldNode) FilterFieldArgList

func (n *FilterFieldNode) FilterFieldArgList() []*FilterFieldArgNode

func (*FilterFieldNode) ResetClearedRequiredFields

func (n *FilterFieldNode) ResetClearedRequiredFields() bool

ResetClearedRequiredFields if true, will reset cleared required fields into a default value.

func (*FilterFieldNode) SetExpr

func (n *FilterFieldNode) SetExpr(v ExprNode)

func (*FilterFieldNode) SetFilterFieldArgList

func (n *FilterFieldNode) SetFilterFieldArgList(v []*FilterFieldArgNode)

func (*FilterFieldNode) SetResetClearedRequiredFields

func (n *FilterFieldNode) SetResetClearedRequiredFields(v bool)

type FilterScanNode

type FilterScanNode struct {
	*BaseScanNode
}

FilterScanNode scan rows from input_scan, and emit all rows where filter_expr evaluates to true. filter_expr is always of type bool. This node's column_list will be a subset of input_scan's column_list.

func (*FilterScanNode) FilterExpr

func (n *FilterScanNode) FilterExpr() ExprNode

func (*FilterScanNode) InputScan

func (n *FilterScanNode) InputScan() ScanNode

func (*FilterScanNode) SetFilterExpr

func (n *FilterScanNode) SetFilterExpr(v ExprNode)

func (*FilterScanNode) SetInputScan

func (n *FilterScanNode) SetInputScan(v ScanNode)

type FilterUsingActionNode

type FilterUsingActionNode struct {
	*BaseAlterActionNode
}

FilterUsingActionNode FILTER USING action for ALTER ROW ACCESS POLICY statement

<predicate> is a boolean expression that selects the rows that are being

made visible.

<predicate_str> is the string form of the predicate.

func (*FilterUsingActionNode) Predicate

func (n *FilterUsingActionNode) Predicate() ExprNode

func (*FilterUsingActionNode) PredicateStr

func (n *FilterUsingActionNode) PredicateStr() string

func (*FilterUsingActionNode) SetPredicate

func (n *FilterUsingActionNode) SetPredicate(v ExprNode)

func (*FilterUsingActionNode) SetPredicateStr

func (n *FilterUsingActionNode) SetPredicateStr(v string)

type FlattenNode

type FlattenNode struct {
	*BaseExprNode
}

FlattenNode constructs an initial input ARRAY<T> from expr. For each FieldList expr, we evaluate the expression once with each array input element and use the output as a new array of inputs for the next FieldList expr. If the result of a single expr is an array, we add each element from that array as input to the next step instead of adding the array itself.

The array elements are evaluated and kept in order. For example, if only expr is an array, the result will be equivalent to that array having the FieldList evaluated on each array element retaining order.

func (*FlattenNode) AddGetField

func (n *FlattenNode) AddGetField(v ExprNode)

func (*FlattenNode) Expr

func (n *FlattenNode) Expr() ExprNode

func (*FlattenNode) GetFieldList

func (n *FlattenNode) GetFieldList() []ExprNode

FieldList list of 'get' fields to evaluate in order (0 or more struct get fields followed by 0 or more proto or json get fields) starting from expr. Each get is evaluated N times where N is the number of array elements from the previous get (or expr for the first expression) generated.

The 'get' fields may either be a Get*Field or an array offset function around a Get*Field.

func (*FlattenNode) SetExpr

func (n *FlattenNode) SetExpr(v ExprNode)

func (*FlattenNode) SetGetFieldList

func (n *FlattenNode) SetGetFieldList(v []ExprNode)

type FlattenedArgNode

type FlattenedArgNode struct {
	*BaseExprNode
}

FlattenArgNode argument for a child of FlattenNode. This is a placeholder to indicate that it will be invoked once for each array element from FlattenNode's expr or previous GetfieldList entry.

type ForeignKeyNode

type ForeignKeyNode struct {
	*BaseConstraintNode
}

ForeignKeyNode this represents the FOREIGN KEY constraint on a table. It is of the form:

CONSTRAINT <constraint_name>
FOREIGN KEY <referencing_column_offset_list>
REFERENCES <referenced_table> <referenced_column_offset_list>
<match_mode>
<update_action>
<delete_action>
<enforced>
<option_list>

<constraint_name> uniquely identifies the constraint.

<referencing_column_offset_list> provides the offsets of the column definitions for the table defining the foreign key.

<referenced_table> identifies the table this constraint references.

<referenced_column_offset_list> provides the offsets of the column definitions for the table referenced by the foreign key.

<match_mode> specifies how referencing keys with null values are handled.

<update_action> specifies what action to take, if any, when a referenced value is updated.

<delete_action> specifies what action to take, if any, when a row with a referenced values is deleted.

<enforced> specifies whether or not the constraint is enforced.

<option_list> for foreign key table constraints. Empty for foreign key column attributes (see instead ColumnAnnotationsNode).

<referencing_column_list> provides the names for the foreign key's referencing columns.

func (*ForeignKeyNode) AddOption

func (n *ForeignKeyNode) AddOption(v *OptionNode)

func (*ForeignKeyNode) AddReferencedColumnOffset

func (n *ForeignKeyNode) AddReferencedColumnOffset(v int)

func (*ForeignKeyNode) AddReferencingColumn

func (n *ForeignKeyNode) AddReferencingColumn(v string)

func (*ForeignKeyNode) AddReferencingColumnOffset

func (n *ForeignKeyNode) AddReferencingColumnOffset(v int)

func (*ForeignKeyNode) ConstraintName

func (n *ForeignKeyNode) ConstraintName() string

func (*ForeignKeyNode) DeleteAction

func (n *ForeignKeyNode) DeleteAction() ActionOperation

func (*ForeignKeyNode) Enforced

func (n *ForeignKeyNode) Enforced() bool

func (*ForeignKeyNode) MatchMode

func (n *ForeignKeyNode) MatchMode() MatchMode

func (*ForeignKeyNode) OptionList

func (n *ForeignKeyNode) OptionList() []*OptionNode

func (*ForeignKeyNode) ReferencedColumnOffsetList

func (n *ForeignKeyNode) ReferencedColumnOffsetList() []int

func (*ForeignKeyNode) ReferencedTable

func (n *ForeignKeyNode) ReferencedTable() types.Table

func (*ForeignKeyNode) ReferencingColumnList

func (n *ForeignKeyNode) ReferencingColumnList() []string

func (*ForeignKeyNode) ReferencingColumnOffsetList

func (n *ForeignKeyNode) ReferencingColumnOffsetList() []int

func (*ForeignKeyNode) SetConstraintName

func (n *ForeignKeyNode) SetConstraintName(v string)

func (*ForeignKeyNode) SetDeleteAction

func (n *ForeignKeyNode) SetDeleteAction(v ActionOperation)

func (*ForeignKeyNode) SetEnforced

func (n *ForeignKeyNode) SetEnforced(v bool)

func (*ForeignKeyNode) SetMatchMode

func (n *ForeignKeyNode) SetMatchMode(v MatchMode)

func (*ForeignKeyNode) SetOptionList

func (n *ForeignKeyNode) SetOptionList(v []*OptionNode)

func (*ForeignKeyNode) SetReferencedColumnOffsetList

func (n *ForeignKeyNode) SetReferencedColumnOffsetList(v []int)

func (*ForeignKeyNode) SetReferencedTable

func (n *ForeignKeyNode) SetReferencedTable(v types.Table)

func (*ForeignKeyNode) SetReferencingColumnList

func (n *ForeignKeyNode) SetReferencingColumnList(v []string)

func (*ForeignKeyNode) SetReferencingColumnOffsetList

func (n *ForeignKeyNode) SetReferencingColumnOffsetList(v []int)

func (*ForeignKeyNode) SetUpdateAction

func (n *ForeignKeyNode) SetUpdateAction(v ActionOperation)

func (*ForeignKeyNode) UpdateAction

func (n *ForeignKeyNode) UpdateAction() ActionOperation

type FrameUnit

type FrameUnit int
const (
	FrameUnitRows  FrameUnit = 0
	FrameUnitRange FrameUnit = 1
)

type FunctionArgumentNode

type FunctionArgumentNode struct {
	*BaseArgumentNode
}

FunctionArgumentNode this represents a generic argument to a function. The argument can be semantically an expression, relation, model, connection or descriptor. Only one of the five fields will be set.

<expr> represents a scalar function argument. <scan> represents a table-typed argument. <model> represents a ML model function argument. <connection> represents a connection object function argument. <descriptor_arg> represents a descriptor object function argument.

This node could be used in multiple places: * TVFScanNode supports all of these. * FunctionCallNode supports only <expr>. * CallStmtNode supports only <expr>.

If the argument has type <scan>, <argument_column_list> maps columns from <scan> into specific columns of the argument's input schema, matching those columns positionally. i.e. <scan>'s column_list may have fewer columns or out-of-order columns, and this vector maps those columns into specific input columns.

func (*FunctionArgumentNode) AddArgumentColumn

func (n *FunctionArgumentNode) AddArgumentColumn(v *Column)

func (*FunctionArgumentNode) ArgumentColumnList

func (n *FunctionArgumentNode) ArgumentColumnList() []*Column

func (*FunctionArgumentNode) Connection

func (n *FunctionArgumentNode) Connection() *ConnectionNode

func (*FunctionArgumentNode) DescriptorArg

func (n *FunctionArgumentNode) DescriptorArg() *DescriptorNode

func (*FunctionArgumentNode) Expr

func (n *FunctionArgumentNode) Expr() ExprNode

func (*FunctionArgumentNode) InlineLambda

func (n *FunctionArgumentNode) InlineLambda() *InlineLambdaNode

func (*FunctionArgumentNode) Model

func (n *FunctionArgumentNode) Model() *ModelNode

func (*FunctionArgumentNode) Scan

func (n *FunctionArgumentNode) Scan() ScanNode

func (*FunctionArgumentNode) SetArgumentColumnList

func (n *FunctionArgumentNode) SetArgumentColumnList(v []*Column)

func (*FunctionArgumentNode) SetConnection

func (n *FunctionArgumentNode) SetConnection(v *ConnectionNode)

func (*FunctionArgumentNode) SetDescriptorArg

func (n *FunctionArgumentNode) SetDescriptorArg(v *DescriptorNode)

func (*FunctionArgumentNode) SetExpr

func (n *FunctionArgumentNode) SetExpr(v ExprNode)

func (*FunctionArgumentNode) SetInlineLambda

func (n *FunctionArgumentNode) SetInlineLambda(v *InlineLambdaNode)

func (*FunctionArgumentNode) SetModel

func (n *FunctionArgumentNode) SetModel(v *ModelNode)

func (*FunctionArgumentNode) SetScan

func (n *FunctionArgumentNode) SetScan(v ScanNode)

type FunctionCallInfo

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

FunctionCallInfo contains custom information about a particular function call. ZetaSQL passes it to the engine in the FunctionCallNode. Functions may introduce subclasses of this class to add custom information as needed on a per-function basis.

func (*FunctionCallInfo) DebugString

func (f *FunctionCallInfo) DebugString() string

type FunctionCallNode

type FunctionCallNode struct {
	*BaseFunctionCallNode
}

FunctionCallNode a regular function call. The signature will always have mode SCALAR. Most scalar expressions show up as FunctionCalls using builtin signatures.

func (*FunctionCallNode) FunctionCallInfo

func (n *FunctionCallNode) FunctionCallInfo() *FunctionCallInfo

FunctionCallInfo this contains optional custom information about a particular function call.

If some Function subclass requires computing additional information at resolving time, that extra information can be stored as a subclass of FunctionCallInfoNode here. For example, TemplatedSQLFunction stores the resolved template body here as a TemplatedSQLFunctionCall.

This field is ignorable because for most types of function calls, there is no extra information to consider besides the arguments and other fields from BaseFunctionCallNode.

func (*FunctionCallNode) SetFunctionCallInfo

func (n *FunctionCallNode) SetFunctionCallInfo(v *FunctionCallInfo)

type FunctionSignatureHolderNode

type FunctionSignatureHolderNode struct {
	*BaseArgumentNode
}

FunctionSignatureHolderNode this wrapper is used for an optional FunctionSignature.

func (*FunctionSignatureHolderNode) SetSignature

func (*FunctionSignatureHolderNode) Signature

type GeneratedColumnInfoNode

type GeneratedColumnInfoNode struct {
	*BaseArgumentNode
}

GeneratedColumnInfoNode <expression> indicates the expression that defines the column. The type of the expression will always match the type of the column.

  • The <expression> can contain ColumnRefsNode corresponding to ColumnDefinitionNode.Column for any of the ColumnDefinitionsNode in the enclosing statement.
  • The expression can never include a subquery.

<stored_mode> is the mode of a generated column: Values are:

  • 'NON_STORED': The <expression> must always be evaluated at read time.
  • 'STORED': The <expression> should be pre-emptively computed at write time (to save work at read time) and must not call any volatle function (e.g. RAND).
  • 'STORED_VOLATILE': The <expression> must be computed at write time and may call volatile functions (e.g. RAND).

func (*GeneratedColumnInfoNode) Expression

func (n *GeneratedColumnInfoNode) Expression() ExprNode

func (*GeneratedColumnInfoNode) SetExpression

func (n *GeneratedColumnInfoNode) SetExpression(v ExprNode)

func (*GeneratedColumnInfoNode) SetStoredMode

func (n *GeneratedColumnInfoNode) SetStoredMode(v StoredMode)

func (*GeneratedColumnInfoNode) StoredMode

func (n *GeneratedColumnInfoNode) StoredMode() StoredMode

type GetJsonFieldNode

type GetJsonFieldNode struct {
	*BaseExprNode
}

GetJsonFieldNode get the field FieldName from Expr, which has a JSON type.

func (*GetJsonFieldNode) Expr

func (n *GetJsonFieldNode) Expr() ExprNode

func (*GetJsonFieldNode) FieldName

func (n *GetJsonFieldNode) FieldName() string

func (*GetJsonFieldNode) SetExpr

func (n *GetJsonFieldNode) SetExpr(v ExprNode)

func (*GetJsonFieldNode) SetFieldName

func (n *GetJsonFieldNode) SetFieldName(v string)

type GetProtoFieldNode

type GetProtoFieldNode struct {
	*BaseExprNode
}

GetProtoFieldNode.

func (*GetProtoFieldNode) DefaultValue

func (n *GetProtoFieldNode) DefaultValue() types.Value

DefaultValue to use when the proto field is not set. The default may be nil (e.g. for proto2 fields with a use_defaults=false annotation).

This will not be filled in (the Value will be uninitialized) if HasBit is true, or the field is required.

If FieldDescriptor().IsRequired() and the field is not present, the engine should return an error.

If the Expr itself returns nil, then extracting a field should also return nil, unless ReturnDefaultValueWhenUnset is true. In that case, the default value is returned.

TODO Make un-ignorable after clients migrate to start using it.

func (*GetProtoFieldNode) Expr

func (n *GetProtoFieldNode) Expr() ExprNode

func (*GetProtoFieldNode) Format

func (n *GetProtoFieldNode) Format() FieldFormat

Format provides the Format annotation that should be used when reading this field. The annotation specifies both the ZetaSQL type and the encoding format for this field. This cannot be set when HasBit is true.

func (*GetProtoFieldNode) HasBit

func (n *GetProtoFieldNode) HasBit() bool

HasBit indicates whether to return a bool indicating if a value was present, rather than return the value (or nil). Never set for repeated fields. This field cannot be set if ReturnDefaultValueWhenUnset is true, and vice versa. Expression type will be BOOL.

func (*GetProtoFieldNode) ReturnDefaultValueWhenUnset

func (n *GetProtoFieldNode) ReturnDefaultValueWhenUnset() bool

ReturnDefaultValueWhenUnset indicates that the default value should be returned if Expr (the parent message) is nil. Note that this does *not* affect the return value when the extracted field itself is unset, in which case the return value depends on the extracted field's annotations (e.g., UseFieldDefaults).

This can only be set for non-message fields. If the field is a proto2 field, then it must be annotated with zetasql.UseDefaults=true. This cannot be set when HasBit is true or the field is required.

func (*GetProtoFieldNode) SetDefaultValue

func (n *GetProtoFieldNode) SetDefaultValue(v types.Value)

func (*GetProtoFieldNode) SetExpr

func (n *GetProtoFieldNode) SetExpr(v ExprNode)

func (*GetProtoFieldNode) SetFormat

func (n *GetProtoFieldNode) SetFormat(v FieldFormat)

func (*GetProtoFieldNode) SetHasBit

func (n *GetProtoFieldNode) SetHasBit(v bool)

func (*GetProtoFieldNode) SetReturnDefaultValueWhenUnset

func (n *GetProtoFieldNode) SetReturnDefaultValueWhenUnset(v bool)

type GetStructFieldNode

type GetStructFieldNode struct {
	*BaseExprNode
}

GetStructFieldNode get the field in position FieldIdx (0-based) from Expr, which has a STRUCT type.

func (*GetStructFieldNode) Expr

func (n *GetStructFieldNode) Expr() ExprNode

func (*GetStructFieldNode) FieldIdx

func (n *GetStructFieldNode) FieldIdx() int

func (*GetStructFieldNode) SetExpr

func (n *GetStructFieldNode) SetExpr(v ExprNode)

func (*GetStructFieldNode) SetFieldIdx

func (n *GetStructFieldNode) SetFieldIdx(v int)

type GrantOrRevokeStmtNode

type GrantOrRevokeStmtNode struct {
	*BaseStatementNode
}

GrantOrRevokeStmtNode common node of GRANT/REVOKE statements.

<privilege_list> is the list of privileges to be granted/revoked. ALL PRIVILEGES should be granted/fromed if it is empty. <object_type> is an optional string identifier, e.g., TABLE, VIEW. <name_path> is a vector of segments of the object identifier's pathname. <grantee_list> (DEPRECATED) is the list of grantees (strings). <grantee_expr_list> is the list of grantees, and may include parameters.

Only one of <grantee_list> or <grantee_expr_list> will be populated, depending on whether or not the FEATURE_PARAMETERS_IN_GRANTEE_LIST is enabled. The <grantee_list> is deprecated, and will be removed along with the corresponding FEATURE once all engines have migrated to use the <grantee_expr_list>. Once <grantee_expr_list> is the only one, then it should be marked as NOT_IGNORABLE.

func (*GrantOrRevokeStmtNode) AddGrantee

func (n *GrantOrRevokeStmtNode) AddGrantee(v string)

func (*GrantOrRevokeStmtNode) AddGranteeExpr

func (n *GrantOrRevokeStmtNode) AddGranteeExpr(v ExprNode)

func (*GrantOrRevokeStmtNode) AddNamePath

func (n *GrantOrRevokeStmtNode) AddNamePath(v string)

func (*GrantOrRevokeStmtNode) AddPrivilege

func (n *GrantOrRevokeStmtNode) AddPrivilege(v *PrivilegeNode)

func (*GrantOrRevokeStmtNode) GranteeExprList

func (n *GrantOrRevokeStmtNode) GranteeExprList() []ExprNode

func (*GrantOrRevokeStmtNode) GranteeList

func (n *GrantOrRevokeStmtNode) GranteeList() []string

func (*GrantOrRevokeStmtNode) NamePath

func (n *GrantOrRevokeStmtNode) NamePath() []string

func (*GrantOrRevokeStmtNode) ObjectType

func (n *GrantOrRevokeStmtNode) ObjectType() string

func (*GrantOrRevokeStmtNode) PrivilegeList

func (n *GrantOrRevokeStmtNode) PrivilegeList() []*PrivilegeNode

func (*GrantOrRevokeStmtNode) SetGranteeExprList

func (n *GrantOrRevokeStmtNode) SetGranteeExprList(v []ExprNode)

func (*GrantOrRevokeStmtNode) SetGranteeList

func (n *GrantOrRevokeStmtNode) SetGranteeList(v []string)

func (*GrantOrRevokeStmtNode) SetNamePath

func (n *GrantOrRevokeStmtNode) SetNamePath(v []string)

func (*GrantOrRevokeStmtNode) SetObjectType

func (n *GrantOrRevokeStmtNode) SetObjectType(v string)

func (*GrantOrRevokeStmtNode) SetPrivilegeList

func (n *GrantOrRevokeStmtNode) SetPrivilegeList(v []*PrivilegeNode)

type GrantStmtNode

type GrantStmtNode struct {
	*GrantOrRevokeStmtNode
}

GrantStmtNode a GRANT statement. It represents the action to grant a list of privileges on a specific object to/from list of grantees.

type GrantToActionNode

type GrantToActionNode struct {
	*BaseAlterActionNode
}

GrantToActionNode GRANT TO action for ALTER ROW ACCESS POLICY statement

<grantee_expr_list> is the list of grantees, and may include parameters.

func (*GrantToActionNode) AddGranteeExpr

func (n *GrantToActionNode) AddGranteeExpr(v ExprNode)

func (*GrantToActionNode) GranteeExprList

func (n *GrantToActionNode) GranteeExprList() []ExprNode

func (*GrantToActionNode) SetGranteeExprList

func (n *GrantToActionNode) SetGranteeExprList(v []ExprNode)

type GroupRowsScanNode

type GroupRowsScanNode struct {
	*BaseScanNode
}

GroupRowsScanNode represents a call to a special TVF GROUP_ROWS(). It can only show up inside WITH GROUP_ROWS clause, which is resolved as the field with_group_rows_subquery in BaseNonScalarFunctionCallNode GroupRowsScanNode. This scan produces rows corresponding to the input of AggregateScanNode that belong to the current group.

<input_column_list> is a list of new columns created to store values coming from the input of the aggregate scan. ComputedColumnNode can only hold ColumnRefNode's and can reference anything from the pre-aggregation scan.

<alias> is the alias of the scan or empty if none.

func (*GroupRowsScanNode) AddInputColumn

func (n *GroupRowsScanNode) AddInputColumn(v *ComputedColumnNode)

func (*GroupRowsScanNode) Alias

func (n *GroupRowsScanNode) Alias() string

func (*GroupRowsScanNode) InputColumnList

func (n *GroupRowsScanNode) InputColumnList() []*ComputedColumnNode

func (*GroupRowsScanNode) SetAlias

func (n *GroupRowsScanNode) SetAlias(v string)

func (*GroupRowsScanNode) SetInputColumnList

func (n *GroupRowsScanNode) SetInputColumnList(v []*ComputedColumnNode)

type GroupingSetNode

type GroupingSetNode struct {
	*BaseArgumentNode
}

GroupingSetNode list of group by columns that form a grouping set.

Columns must come from group_by_list in AggregateScanNode. group_by_column_list will not contain any duplicates. There may be more than one GroupingSetNode in the AggregateScanNode with the same columns, however.

func (*GroupingSetNode) AddGroupByColumn

func (n *GroupingSetNode) AddGroupByColumn(v *ColumnRefNode)

func (*GroupingSetNode) GroupByColumnList

func (n *GroupingSetNode) GroupByColumnList() []*ColumnRefNode

func (*GroupingSetNode) SetGroupByColumnList

func (n *GroupingSetNode) SetGroupByColumnList(v []*ColumnRefNode)

type HavingModifierKind

type HavingModifierKind int
const (
	HavingModifierKindInvalid HavingModifierKind = 0
	HavingModifierKindMax     HavingModifierKind = 1
	HavingModifierKindMin     HavingModifierKind = 2
)

type ImportKind

type ImportKind int
const (
	ImportKindModule ImportKind = 0
	ImportKindProto  ImportKind = 1
)

type ImportStmtNode

type ImportStmtNode struct {
	*BaseStatementNode
}

ImportStmtNode this statement: IMPORT <import_kind>

      [<name_path> [AS|INTO <alias_path>]
      |<file_path>]
[<option_list>];

<import_kind> The type of the object, currently supports MODULE and PROTO. <name_path> The identifier path of the object to import, e.g., foo.bar,

used in IMPORT MODULE statement.

<file_path> The file path of the object to import, e.g., "file.proto",

used in IMPORT PROTO statement.

<alias_path> The AS alias path for the object. <into_alias_path> The INTO alias path for the object. <option_list> Engine-specific directives for the import.

Either <name_path> or <file_path> will be populated but not both.

<name_path> will be populated for IMPORT MODULE.
<file_path> will be populated for IMPORT PROTO.

At most one of <alias_path> or <into_alias_path> will be populated.

<alias_path> may be populated for IMPORT MODULE.
<into_alias_path> may be populated for IMPORT PROTO.

IMPORT MODULE and IMPORT PROTO both support options.

func (*ImportStmtNode) AddAliasPath

func (n *ImportStmtNode) AddAliasPath(v string)

func (*ImportStmtNode) AddIntoAliasPath

func (n *ImportStmtNode) AddIntoAliasPath(v string)

func (*ImportStmtNode) AddNamePath

func (n *ImportStmtNode) AddNamePath(v string)

func (*ImportStmtNode) AddOption

func (n *ImportStmtNode) AddOption(v *OptionNode)

func (*ImportStmtNode) AliasPath

func (n *ImportStmtNode) AliasPath() []string

func (*ImportStmtNode) FilePath

func (n *ImportStmtNode) FilePath() string

func (*ImportStmtNode) ImportKind

func (n *ImportStmtNode) ImportKind() ImportKind

func (*ImportStmtNode) IntoAliasPath

func (n *ImportStmtNode) IntoAliasPath() []string

func (*ImportStmtNode) NamePath

func (n *ImportStmtNode) NamePath() []string

func (*ImportStmtNode) OptionList

func (n *ImportStmtNode) OptionList() []*OptionNode

func (*ImportStmtNode) SetAliasPath

func (n *ImportStmtNode) SetAliasPath(v []string)

func (*ImportStmtNode) SetFilePath

func (n *ImportStmtNode) SetFilePath(v string)

func (*ImportStmtNode) SetImportKind

func (n *ImportStmtNode) SetImportKind(v ImportKind)

func (*ImportStmtNode) SetIntoAliasPath

func (n *ImportStmtNode) SetIntoAliasPath(v []string)

func (*ImportStmtNode) SetNamePath

func (n *ImportStmtNode) SetNamePath(v []string)

func (*ImportStmtNode) SetOptionList

func (n *ImportStmtNode) SetOptionList(v []*OptionNode)

type IndexItemNode

type IndexItemNode struct {
	*BaseArgumentNode
}

IndexItemNode represents one of indexed items in CREATE INDEX statement, with the ordering direction specified.

func (*IndexItemNode) ColumnRef

func (n *IndexItemNode) ColumnRef() *ColumnRefNode

func (*IndexItemNode) Descending

func (n *IndexItemNode) Descending() bool

func (*IndexItemNode) SetColumnRef

func (n *IndexItemNode) SetColumnRef(v *ColumnRefNode)

func (*IndexItemNode) SetDescending

func (n *IndexItemNode) SetDescending(v bool)

type InlineLambdaNode

type InlineLambdaNode struct {
	*BaseArgumentNode
}

InlineLambdaNode a lambda expression, used inline as a function argument. This represents both the definition of the lambda and the resolution of its templated signature and body for this function call. Currently can only be used as an argument of a function.

ArgumentList defines the argument types and names for the lambda, and creates new ColumnsNode which can be used to reference the arguments inside Body.

The return type of the lambda function is the type of Body.

In addition to the ArgumentList, the body of a lambda expression can reference columns visible to the scope of the function call for which this lambda is provided as an argument. Columns in this scope accessed by the body are stored in ParameterList.

For example, the following query

SELECT ARRAY_FILTER([1,2,3], e -> e = key) FROM KeyValue;

would have a lambda with ParameterList ['key'] and ArgumentList ['e'].

Body is the body expression of the lambda. The expression can only reference columns in ParameterList and ArgumentList.

func (*InlineLambdaNode) AddArgument

func (n *InlineLambdaNode) AddArgument(v *Column)

func (*InlineLambdaNode) AddParameter

func (n *InlineLambdaNode) AddParameter(v *ColumnRefNode)

func (*InlineLambdaNode) ArgumentList

func (n *InlineLambdaNode) ArgumentList() []*Column

func (*InlineLambdaNode) Body

func (n *InlineLambdaNode) Body() ExprNode

func (*InlineLambdaNode) ParameterList

func (n *InlineLambdaNode) ParameterList() []*ColumnRefNode

func (*InlineLambdaNode) SetArgumentList

func (n *InlineLambdaNode) SetArgumentList(v []*Column)

func (*InlineLambdaNode) SetBody

func (n *InlineLambdaNode) SetBody(v ExprNode)

func (*InlineLambdaNode) SetParameterList

func (n *InlineLambdaNode) SetParameterList(v []*ColumnRefNode)

type InsertMode

type InsertMode int
const (
	InsertModeOrError   InsertMode = 0
	InsertModeOrIgnore  InsertMode = 1
	InsertModeOrReplace InsertMode = 2
	InsertModeOrUpdate  InsertMode = 3
)

type InsertRowNode

type InsertRowNode struct {
	*BaseArgumentNode
}

InsertRowNode represents one row in the VALUES clause of an INSERT.

func (*InsertRowNode) AddValue

func (n *InsertRowNode) AddValue(v *DMLValueNode)

func (*InsertRowNode) SetValueList

func (n *InsertRowNode) SetValueList(v []*DMLValueNode)

func (*InsertRowNode) ValueList

func (n *InsertRowNode) ValueList() []*DMLValueNode

type InsertStmtNode

type InsertStmtNode struct {
	*BaseStatementNode
}

InsertStmtNode represents an INSERT statement, or a nested INSERT inside an UPDATE statement.

For top-level INSERT statements, <table_scan> gives the table to scan and creates ResolvedColumns for its columns. Those columns can be referenced in <insert_column_list>.

For nested INSERTS, there is no <table_scan> or <insert_column_list>. There is implicitly a single column to insert, and its type is the element type of the array being updated in the UpdateItemNode containing this statement.

For nested INSERTs, alternate modes are not supported and <insert_mode> will always be set to OR_ERROR.

The rows to insert come from <row_list> or the result of <query>. Exactly one of these must be present.

If <row_list> is present, the columns in the row_list match positionally with <insert_column_list>.

If <query> is present, <query_output_column_list> must also be present. <query_output_column_list> is the list of output columns produced by <query> that correspond positionally with the target <insert_column_list> on the output table. For nested INSERTs with no <insert_column_list>, <query_output_column_list> must have exactly one column.

<query_parameter_list> is set for nested INSERTs where <query> is set and references non-target values (columns or field values) from the table. It is only set when FEATURE_V_1_2_CORRELATED_REFS_IN_NESTED_DML is enabled.

If <returning> is present, the INSERT statement will return newly inserted rows. <returning> can only occur on top-level statements.

The returning clause has a <output_column_list> to represent the data sent back to clients. It can only acccess columns from the <table_scan>.

func (*InsertStmtNode) AddInsertColumn

func (n *InsertStmtNode) AddInsertColumn(v *Column)

func (*InsertStmtNode) AddQueryOutputColumn

func (n *InsertStmtNode) AddQueryOutputColumn(v *Column)

func (*InsertStmtNode) AddQueryParameter

func (n *InsertStmtNode) AddQueryParameter(v *ColumnRefNode)

func (*InsertStmtNode) AddRow

func (n *InsertStmtNode) AddRow(v *InsertRowNode)

func (*InsertStmtNode) AssertRowsModified

func (n *InsertStmtNode) AssertRowsModified() *AssertRowsModifiedNode

func (*InsertStmtNode) InsertColumnList

func (n *InsertStmtNode) InsertColumnList() []*Column

func (*InsertStmtNode) InsertMode

func (n *InsertStmtNode) InsertMode() InsertMode

InsertMode behavior on duplicate rows (normally defined to mean duplicate primary keys).

func (*InsertStmtNode) Query

func (n *InsertStmtNode) Query() ScanNode

func (*InsertStmtNode) QueryOutputColumnList

func (n *InsertStmtNode) QueryOutputColumnList() []*Column

func (*InsertStmtNode) QueryParameterList

func (n *InsertStmtNode) QueryParameterList() []*ColumnRefNode

func (*InsertStmtNode) Returning

func (n *InsertStmtNode) Returning() *ReturningClauseNode

func (*InsertStmtNode) RowList

func (n *InsertStmtNode) RowList() []*InsertRowNode

func (*InsertStmtNode) SetAssertRowsModified

func (n *InsertStmtNode) SetAssertRowsModified(v *AssertRowsModifiedNode)

func (*InsertStmtNode) SetInsertColumnList

func (n *InsertStmtNode) SetInsertColumnList(v []*Column)

func (*InsertStmtNode) SetInsertMode

func (n *InsertStmtNode) SetInsertMode(v InsertMode)

func (*InsertStmtNode) SetQuery

func (n *InsertStmtNode) SetQuery(v ScanNode)

func (*InsertStmtNode) SetQueryOutputColumnList

func (n *InsertStmtNode) SetQueryOutputColumnList(v []*Column)

func (*InsertStmtNode) SetQueryParameterList

func (n *InsertStmtNode) SetQueryParameterList(v []*ColumnRefNode)

func (*InsertStmtNode) SetReturning

func (n *InsertStmtNode) SetReturning(v *ReturningClauseNode)

func (*InsertStmtNode) SetRowList

func (n *InsertStmtNode) SetRowList(v []*InsertRowNode)

func (*InsertStmtNode) SetTableScan

func (n *InsertStmtNode) SetTableScan(v *TableScanNode)

func (*InsertStmtNode) TableScan

func (n *InsertStmtNode) TableScan() *TableScanNode

type InsertionMode

type InsertionMode int
const (
	InsertionModeNone      InsertionMode = 0
	InsertionModeAppend    InsertionMode = 1
	InsertionModeOverwrite InsertionMode = 2
)

type JoinScanNode

type JoinScanNode struct {
	*BaseScanNode
}

JoinScanNode scan that joins two input scans. The <column_list> will contain columns selected from the union of the input scan's <column_lists>. When the join is a LEFT/RIGHT/FULL join, ColumnsNode that came from the non-joined side get NULL values.

func (*JoinScanNode) JoinExpr

func (n *JoinScanNode) JoinExpr() ExprNode

func (*JoinScanNode) JoinType

func (n *JoinScanNode) JoinType() JoinType

func (*JoinScanNode) LeftScan

func (n *JoinScanNode) LeftScan() ScanNode

func (*JoinScanNode) RightScan

func (n *JoinScanNode) RightScan() ScanNode

func (*JoinScanNode) SetJoinExpr

func (n *JoinScanNode) SetJoinExpr(v ExprNode)

func (*JoinScanNode) SetJoinType

func (n *JoinScanNode) SetJoinType(v JoinType)

func (*JoinScanNode) SetLeftScan

func (n *JoinScanNode) SetLeftScan(v ScanNode)

func (*JoinScanNode) SetRightScan

func (n *JoinScanNode) SetRightScan(v ScanNode)

type JoinType

type JoinType int
const (
	JoinTypeInner JoinType = 0
	JoinTypeLeft  JoinType = 1
	JoinTypeRight JoinType = 2
	JoinTypeFull  JoinType = 3
)

type Kind

type Kind int
const (
	Literal                        Kind = 3
	Parameter                      Kind = 4
	ExpressionColumn               Kind = 5
	ColumnRef                      Kind = 6
	Constant                       Kind = 103
	SystemVariable                 Kind = 139
	InlineLambda                   Kind = 159
	FilterFieldArg                 Kind = 173
	FilterField                    Kind = 174
	FunctionCall                   Kind = 8
	AggregateFunctionCall          Kind = 9
	AnalyticFunctionCall           Kind = 10
	ExtendedCastElement            Kind = 151
	ExtendedCast                   Kind = 158
	Cast                           Kind = 11
	MakeStruct                     Kind = 12
	MakeProto                      Kind = 13
	MakeProtoField                 Kind = 14
	GetStructField                 Kind = 15
	GetProtoField                  Kind = 16
	GetJsonField                   Kind = 165
	Flatten                        Kind = 149
	FlattenedArg                   Kind = 150
	ReplaceFieldItem               Kind = 128
	ReplaceField                   Kind = 129
	SubqueryExpr                   Kind = 17
	LetExpr                        Kind = 197
	Model                          Kind = 109
	Connection                     Kind = 141
	Descriptor                     Kind = 144
	SingleRowScan                  Kind = 19
	TableScan                      Kind = 20
	JoinScan                       Kind = 21
	ArrayScan                      Kind = 22
	ColumnHolder                   Kind = 23
	FilterScan                     Kind = 24
	GroupingSet                    Kind = 93
	AggregateScan                  Kind = 25
	AnonymizedAggregateScan        Kind = 112
	SetOperationItem               Kind = 94
	SetOperationScan               Kind = 26
	OrderByScan                    Kind = 27
	LimitOffsetScan                Kind = 28
	WithRefScan                    Kind = 29
	AnalyticScan                   Kind = 30
	SampleScan                     Kind = 31
	ComputedColumn                 Kind = 32
	OrderByItem                    Kind = 33
	ColumnAnnotations              Kind = 104
	GeneratedColumnInfo            Kind = 105
	ColumnDefaultValue             Kind = 188
	ColumnDefinition               Kind = 91
	PrimaryKey                     Kind = 92
	ForeignKey                     Kind = 110
	CheckConstraint                Kind = 113
	OutputColumn                   Kind = 34
	ProjectScan                    Kind = 35
	TVFScan                        Kind = 81
	GroupRowsScan                  Kind = 176
	FunctionArgument               Kind = 82
	ExplainStmt                    Kind = 37
	QueryStmt                      Kind = 38
	CreateDatabaseStmt             Kind = 95
	IndexItem                      Kind = 96
	UnnestItem                     Kind = 126
	CreateIndexStmt                Kind = 97
	CreateSchemaStmt               Kind = 157
	CreateTableStmt                Kind = 90
	CreateTableAsSelectStmt        Kind = 40
	CreateModelStmt                Kind = 107
	CreateViewStmt                 Kind = 41
	WithPartitionColumns           Kind = 153
	CreateSnapshotTableStmt        Kind = 182
	CreateExternalTableStmt        Kind = 42
	ExportModelStmt                Kind = 152
	ExportDataStmt                 Kind = 43
	DefineTableStmt                Kind = 44
	DescribeStmt                   Kind = 45
	ShowStmt                       Kind = 46
	BeginStmt                      Kind = 47
	SetTransactionStmt             Kind = 120
	CommitStmt                     Kind = 48
	RollbackStmt                   Kind = 49
	StartBatchStmt                 Kind = 122
	RunBatchStmt                   Kind = 123
	AbortBatchStmt                 Kind = 124
	DropStmt                       Kind = 50
	DropMaterializedViewStmt       Kind = 121
	DropSnapshotTableStmt          Kind = 183
	RecursiveRefScan               Kind = 147
	RecursiveScan                  Kind = 148
	WithScan                       Kind = 51
	WithEntry                      Kind = 52
	Option                         Kind = 53
	WindowPartitioning             Kind = 54
	WindowOrdering                 Kind = 55
	WindowFrame                    Kind = 56
	AnalyticFunctionGroup          Kind = 57
	WindowFrameExpr                Kind = 58
	DMLValue                       Kind = 59
	DMLDefault                     Kind = 60
	AssertStmt                     Kind = 98
	AssertRowsModified             Kind = 61
	InsertRow                      Kind = 62
	InsertStmt                     Kind = 63
	DeleteStmt                     Kind = 64
	UpdateItem                     Kind = 65
	UpdateArrayItem                Kind = 102
	UpdateStmt                     Kind = 66
	MergeWhen                      Kind = 100
	MergeStmt                      Kind = 101
	TruncateStmt                   Kind = 133
	ObjectUnit                     Kind = 200
	Privilege                      Kind = 67
	GrantStmt                      Kind = 69
	RevokeStmt                     Kind = 70
	AlterDatabaseStmt              Kind = 134
	AlterMaterializedViewStmt      Kind = 127
	AlterSchemaStmt                Kind = 160
	AlterTableStmt                 Kind = 115
	AlterViewStmt                  Kind = 118
	SetOptionsAction               Kind = 117
	AddColumnAction                Kind = 131
	AddConstraintAction            Kind = 163
	DropConstraintAction           Kind = 164
	DropPrimaryKeyAction           Kind = 184
	AlterColumnOptionsAction       Kind = 169
	AlterColumnDropNotNullAction   Kind = 178
	AlterColumnSetDataTypeAction   Kind = 181
	AlterColumnSetDefaultAction    Kind = 198
	AlterColumnDropDefaultAction   Kind = 199
	DropColumnAction               Kind = 132
	RenameColumnAction             Kind = 185
	SetAsAction                    Kind = 156
	SetCollateClause               Kind = 187
	AlterTableSetOptionsStmt       Kind = 71
	RenameStmt                     Kind = 72
	CreatePrivilegeRestrictionStmt Kind = 191
	CreateRowAccessPolicyStmt      Kind = 73
	DropPrivilegeRestrictionStmt   Kind = 192
	DropRowAccessPolicyStmt        Kind = 74
	DropSearchIndexStmt            Kind = 190
	GrantToAction                  Kind = 135
	RestrictToAction               Kind = 193
	AddToRestricteeListAction      Kind = 194
	RemoveFromRestricteeListAction Kind = 195
	FilterUsingAction              Kind = 136
	RevokeFromAction               Kind = 137
	RenameToAction                 Kind = 138
	AlterPrivilegeRestrictionStmt  Kind = 196
	AlterRowAccessPolicyStmt       Kind = 75
	AlterAllRowAccessPoliciesStmt  Kind = 145
	CreateConstantStmt             Kind = 99
	CreateFunctionStmt             Kind = 76
	ArgumentDef                    Kind = 77
	ArgumentRef                    Kind = 78
	CreateTableFunctionStmt        Kind = 88
	RelationArgumentScan           Kind = 89
	ArgumentList                   Kind = 79
	FunctionSignatureHolder        Kind = 84
	DropFunctionStmt               Kind = 80
	DropTableFunctionStmt          Kind = 175
	CallStmt                       Kind = 83
	ImportStmt                     Kind = 86
	ModuleStmt                     Kind = 87
	AggregateHavingModifier        Kind = 85
	CreateMaterializedViewStmt     Kind = 119
	CreateProcedureStmt            Kind = 125
	ExecuteImmediateArgument       Kind = 143
	ExecuteImmediateStmt           Kind = 140
	AssignmentStmt                 Kind = 142
	CreateEntityStmt               Kind = 154
	AlterEntityStmt                Kind = 155
	PivotColumn                    Kind = 166
	PivotScan                      Kind = 161
	ReturningClause                Kind = 170
	UnpivotArg                     Kind = 171
	UnpivotScan                    Kind = 172
	CloneDataStmt                  Kind = 177
	TableAndColumnInfo             Kind = 179
	AnalyzeStmt                    Kind = 180
	AuxLoadDataStmt                Kind = 186
)

type LetExprNode

type LetExprNode struct {
	*BaseExprNode
}

LetExprNode introduces one or more columns in <assignment_list> that can then be referenced inside <expr>. Each assigned expression is evaluated once, and each reference to that column in <expr> sees the same value even if the assigned expression is volatile. Multiple assignment expressions are independent and cannot reference other columns in the <assignment_list>.

<assignment_list> One or more columns that are computed before evaluating

<expr>, and which may be referenced by <expr>.

<expr> Computes the result of the LetExprNode. May reference columns

from <assignment_list>.

func (*LetExprNode) AddAssignment

func (n *LetExprNode) AddAssignment(v *ComputedColumnNode)

func (*LetExprNode) AssignmentList

func (n *LetExprNode) AssignmentList() []*ComputedColumnNode

func (*LetExprNode) Expr

func (n *LetExprNode) Expr() ExprNode

func (*LetExprNode) SetAssignmentList

func (n *LetExprNode) SetAssignmentList(v []*ComputedColumnNode)

func (*LetExprNode) SetExpr

func (n *LetExprNode) SetExpr(v ExprNode)

type LimitOffsetScanNode

type LimitOffsetScanNode struct {
	*BaseScanNode
}

LimitOffsetScanNode apply a LIMIT and optional OFFSET to the rows from input_scan. Emit all rows after OFFSET rows have been scanned and up to LIMIT total rows emitted. The offset is the number of rows to skip. E.g., OFFSET 1 means to skip one row, so the first row emitted will be the second ROW, provided the LIMIT is greater than zero.

The arguments to LIMIT <int64> OFFSET <int64> must be non-negative integer literals or (possibly casted) query parameters. Query parameter values must be checked at run-time by ZetaSQL compliant backend systems.

OFFSET is optional and the absence of OFFSET implies OFFSET 0.

func (*LimitOffsetScanNode) InputScan

func (n *LimitOffsetScanNode) InputScan() ScanNode

func (*LimitOffsetScanNode) Limit

func (n *LimitOffsetScanNode) Limit() ExprNode

func (*LimitOffsetScanNode) Offset

func (n *LimitOffsetScanNode) Offset() ExprNode

func (*LimitOffsetScanNode) SetInputScan

func (n *LimitOffsetScanNode) SetInputScan(v ScanNode)

func (*LimitOffsetScanNode) SetLimit

func (n *LimitOffsetScanNode) SetLimit(v ExprNode)

func (*LimitOffsetScanNode) SetOffset

func (n *LimitOffsetScanNode) SetOffset(v ExprNode)

type LiteralNode

type LiteralNode struct {
	*BaseExprNode
}

LiteralNode any literal value, including NULL literals.

func (*LiteralNode) FloatLiteralID

func (n *LiteralNode) FloatLiteralID() int

FloatLiteralID distinct ID of the literal, if it is a floating point value, within the resolved AST. When coercing from floating point to NUMERIC, the resolver uses the float_literal_id to find the original image of the literal to avoid precision loss. An ID of 0 represents a literal without a cached image.

func (*LiteralNode) HasExplicitType

func (n *LiteralNode) HasExplicitType() bool

HasExplicitType if true, then the literal is explicitly typed and cannot be used for literal coercions.

This exists mainly for resolver bookkeeping and should be ignored by engines.

func (*LiteralNode) PreserveInLiteralRemover

func (n *LiteralNode) PreserveInLiteralRemover() bool

PreserveInLiteralRemover indicates whether ReplaceLiteralsByParameters() should leave this literal value in place, rather than replace it with a query parameter.

func (*LiteralNode) SetFloatLiteralID

func (n *LiteralNode) SetFloatLiteralID(v int)

func (*LiteralNode) SetHasExplicitType

func (n *LiteralNode) SetHasExplicitType(v bool)

func (*LiteralNode) SetPreserveInLiteralRemover

func (n *LiteralNode) SetPreserveInLiteralRemover(v bool)

func (*LiteralNode) SetValue

func (n *LiteralNode) SetValue(v types.Value)

func (*LiteralNode) Value

func (n *LiteralNode) Value() types.Value

type MakeProtoFieldNode

type MakeProtoFieldNode struct {
	*BaseArgumentNode
}

MakeProtoFieldNode one field assignment in a MakeProtoNode expression. The type of expr will match with the zetasql type of the proto field. The type will be an array if the field is repeated.

For NULL values of Expr, the proto field should be cleared.

If any value of Expr cannot be written into the field, this query should fail.

func (*MakeProtoFieldNode) Expr

func (n *MakeProtoFieldNode) Expr() ExprNode

func (*MakeProtoFieldNode) Format

func (n *MakeProtoFieldNode) Format() FieldFormat

Format provides the Format annotation that should be used when building this field. The annotation specifies both the ZetaSQL type and the encoding format for this field.

func (*MakeProtoFieldNode) SetExpr

func (n *MakeProtoFieldNode) SetExpr(v ExprNode)

func (*MakeProtoFieldNode) SetFormat

func (n *MakeProtoFieldNode) SetFormat(v FieldFormat)

type MakeProtoNode

type MakeProtoNode struct {
	*BaseExprNode
}

MakeProtoNode construct a proto value. Type is always a ProtoType. FieldList is a vector of (FieldDescriptor, expr) pairs to write. FieldList will contain all required fields, and no duplicate fields.

func (*MakeProtoNode) AddField

func (n *MakeProtoNode) AddField(v *MakeProtoFieldNode)

func (*MakeProtoNode) FieldList

func (n *MakeProtoNode) FieldList() []*MakeProtoFieldNode

func (*MakeProtoNode) SetFieldList

func (n *MakeProtoNode) SetFieldList(v []*MakeProtoFieldNode)

type MakeStructNode

type MakeStructNode struct {
	*BaseExprNode
}

MakeStructNode construct a struct value. Type is always a StructType. FieldList matches 1:1 with the fields in Type position-wise. Each field's type will match the corresponding field in Type.

func (*MakeStructNode) AddField

func (n *MakeStructNode) AddField(v ExprNode)

func (*MakeStructNode) FieldList

func (n *MakeStructNode) FieldList() []ExprNode

func (*MakeStructNode) SetFieldList

func (n *MakeStructNode) SetFieldList(v []ExprNode)

type MatchMode

type MatchMode int
const (
	MatchModeSimple      MatchMode = 0
	MatchModeFull        MatchMode = 1
	MatchModeNotDistinct MatchMode = 2
)

type MatchType

type MatchType int
const (
	MatchTypeMatched            MatchType = 0
	MatchTypeNotMatchedBySource MatchType = 1
	MatchTypeNotMatchedByTarget MatchType = 2
)

type MergeStmtNode

type MergeStmtNode struct {
	*BaseStatementNode
}

MergeStmtNode represents a MERGE statement.

<table_scan> gives the target table to scan and creates Columns for its columns.

<column_access_list> indicates for each column, whether it was read and/or written. The columns in this vector match those of <table_scan.column_list>. If a column was not encountered when producing the resolved AST, then the value at that index will be Statement::NONE(0).

The output of <from_scan> is joined with <table_scan> using the join expression <merge_expr>.

The order of elements in <when_clause_list> matters, as they are executed sequentially. At most one of the <when_clause_list> clause will be applied to each row from <table_scan>.

<table_scan>, <from_scan>, <merge_expr> and <when_clause_list> are required. <when_clause_list> must be non-empty.

func (*MergeStmtNode) AddColumnAccess

func (n *MergeStmtNode) AddColumnAccess(v ObjectAccess)

func (*MergeStmtNode) AddWhenClause

func (n *MergeStmtNode) AddWhenClause(v *MergeWhenNode)

func (*MergeStmtNode) ColumnAccessList

func (n *MergeStmtNode) ColumnAccessList() []ObjectAccess

func (*MergeStmtNode) FromScan

func (n *MergeStmtNode) FromScan() ScanNode

func (*MergeStmtNode) MergeExpr

func (n *MergeStmtNode) MergeExpr() ExprNode

func (*MergeStmtNode) SetColumnAccessList

func (n *MergeStmtNode) SetColumnAccessList(v []ObjectAccess)

func (*MergeStmtNode) SetFromScan

func (n *MergeStmtNode) SetFromScan(v ScanNode)

func (*MergeStmtNode) SetMergeExpr

func (n *MergeStmtNode) SetMergeExpr(v ExprNode)

func (*MergeStmtNode) SetTableScan

func (n *MergeStmtNode) SetTableScan(v *TableScanNode)

func (*MergeStmtNode) SetWhenClauseList

func (n *MergeStmtNode) SetWhenClauseList(v []*MergeWhenNode)

func (*MergeStmtNode) TableScan

func (n *MergeStmtNode) TableScan() *TableScanNode

func (*MergeStmtNode) WhenClauseList

func (n *MergeStmtNode) WhenClauseList() []*MergeWhenNode

type MergeWhenNode

type MergeWhenNode struct {
	*BaseArgumentNode
}

MergeWhenNode this is used by MergeStmtNode to represent one WHEN ... THEN clause within MERGE statement.

There are three types of clauses, which are MATCHED, NOT_MATCHED_BY_SOURCE and NOT_MATCHED_BY_TARGET. The <match_type> must have one of these values.

The <match_expr> defines an optional expression to apply to the join result of <table_scan> and <from_scan> of the parent MergeStmtNode.

Each MergeWhenNode must define exactly one of three operations,

-- INSERT: <action_type> is MergeWhenNode::INSERT.
           Both <insert_column_list> and <insert_row> are non-empty.
           The size of <insert_column_list> must be the same with the
           value_list size of <insert_row>, and, the column data type
           must match.
-- UPDATE: <action_type> is MergeWhenNode::UPDATE.
           <update_item_list> is non-empty.
-- DELETE: <action_type> is MergeWhenNode::DELETE.

The INSERT, UPDATE and DELETE operations are mutually exclusive.

When <match_type> is MATCHED, <action_type> must be UPDATE or DELETE. When <match_type> is NOT_MATCHED_BY_TARGET, <action_type> must be INSERT. When <match_type> is NOT_MATCHED_BY_SOURCE, <action_type> must be UPDATE or DELETE.

The column visibility within a ResolvedMergeWhen clause is defined as following,

-- When <match_type> is MATCHED,
   -- All columns from <table_scan> and <from_scan> are allowed in
      <match_expr>.
   -- If <action_type> is UPDATE, only columns from <table_scan> are
      allowed on left side of expressions in <update_item_list>.
      All columns from <table_scan> and <from_scan> are allowed on right
      side of expressions in <update_item_list>.
-- When <match_type> is NOT_MATCHED_BY_TARGET,
   -- Only columns from <from_scan> are allowed in <match_expr>.
   -- Only columns from <table_scan> are allowed in
      <insert_column_list>.
   -- Only columns from <from_scan> are allowed in <insert_row>.
-- When <match_type> is NOT_MATCHED_BY_SOURCE,
   -- Only columns from <table_scan> are allowed in <match_expr>.
   -- If <action_type> is UPDATE, only columns from <table_scan> are
      allowed in <update_item_list>.

func (*MergeWhenNode) ActionType

func (n *MergeWhenNode) ActionType() ActionType

func (*MergeWhenNode) AddInsertColumn

func (n *MergeWhenNode) AddInsertColumn(v *Column)

func (*MergeWhenNode) AddUpdateItem

func (n *MergeWhenNode) AddUpdateItem(v *UpdateItemNode)

func (*MergeWhenNode) InsertColumnList

func (n *MergeWhenNode) InsertColumnList() []*Column

func (*MergeWhenNode) InsertRow

func (n *MergeWhenNode) InsertRow() *InsertRowNode

func (*MergeWhenNode) MatchExpr

func (n *MergeWhenNode) MatchExpr() ExprNode

func (*MergeWhenNode) MatchType

func (n *MergeWhenNode) MatchType() MatchType

func (*MergeWhenNode) SetActionType

func (n *MergeWhenNode) SetActionType(v ActionType)

func (*MergeWhenNode) SetInsertColumnList

func (n *MergeWhenNode) SetInsertColumnList(v []*Column)

func (*MergeWhenNode) SetInsertRow

func (n *MergeWhenNode) SetInsertRow(v *InsertRowNode)

func (*MergeWhenNode) SetMatchExpr

func (n *MergeWhenNode) SetMatchExpr(v ExprNode)

func (*MergeWhenNode) SetMatchType

func (n *MergeWhenNode) SetMatchType(v MatchType)

func (*MergeWhenNode) SetUpdateItemList

func (n *MergeWhenNode) SetUpdateItemList(v []*UpdateItemNode)

func (*MergeWhenNode) UpdateItemList

func (n *MergeWhenNode) UpdateItemList() []*UpdateItemNode

type ModelNode

type ModelNode struct {
	*BaseArgumentNode
}

ModelNode represents a machine learning model as a TVF argument. <model> is the machine learning model object known to the resolver (usually through the catalog).

func (*ModelNode) Model

func (n *ModelNode) Model() types.Model

func (*ModelNode) SetModel

func (n *ModelNode) SetModel(v types.Model)

type ModuleStmtNode

type ModuleStmtNode struct {
	*BaseStatementNode
}

ModuleStmtNode this statement: MODULE <name_path> [<option_list>];

<name_path> is the identifier path of the module. <option_list> Engine-specific directives for the module statement.

func (*ModuleStmtNode) AddNamePath

func (n *ModuleStmtNode) AddNamePath(v string)

func (*ModuleStmtNode) AddOption

func (n *ModuleStmtNode) AddOption(v *OptionNode)

func (*ModuleStmtNode) NamePath

func (n *ModuleStmtNode) NamePath() []string

func (*ModuleStmtNode) OptionList

func (n *ModuleStmtNode) OptionList() []*OptionNode

func (*ModuleStmtNode) SetNamePath

func (n *ModuleStmtNode) SetNamePath(v []string)

func (*ModuleStmtNode) SetOptionList

func (n *ModuleStmtNode) SetOptionList(v []*OptionNode)

type Node

type Node interface {
	// Kind return this node's kind ( e.g. TableScan for TableScanNode ).
	Kind() Kind

	// IsScan return true if this node is under this node type.
	IsScan() bool
	IsExpression() bool
	IsStatement() bool

	// DebugString returns a string representation of this tree and all descendants, for
	// testing and debugging purposes. Each entry in <annotations> will cause the
	// subtree <annotation.node> to be annotated with the string
	// <annotation.annotation>. This can be used to explain the context of
	// certain individual nodes in the tree.
	DebugString() string

	// ChildNodes returns in 'child_nodes' all non-NULL Nodes that are children of
	// this node. The order of 'child_nodes' is deterministic, but callers should
	// not depend on how the roles (fields) correspond to locations, especially
	// because NULL children are omitted. For cases where the roles of child nodes
	// matter, use the specific getter functions provided by subnodes.
	ChildNodes() []Node

	// TreeDepth returns the depth of the AST tree rooted at the current node.
	// Considers all descendants of the current node, and returns the maximum
	// depth. Returns 1 if the current node is a leaf.
	TreeDepth() int

	// Returns the previously recorded parsed location range or nil.
	// Parse location ranges are only filled for some nodes (LiteralNodes in particular) and
	// only if AnalyzerOption.SetParseLocationRecordType() is set.
	ParseLocationRange() *types.ParseLocationRange
	// contains filtered or unexported methods
}

type NullHandlingModifier

type NullHandlingModifier int
const (
	DefaultNullHandling NullHandlingModifier = 0
	IgnoreNulls         NullHandlingModifier = 1
	RespectNulls        NullHandlingModifier = 2
)

type NullOrderMode

type NullOrderMode int
const (
	NullOrderModeOrderUnspecified NullOrderMode = 0
	NullOrderModeNullsFirst       NullOrderMode = 1
	NullOrderModeNullsLast        NullOrderMode = 2
)

type ObjectAccess

type ObjectAccess int
const (
	ObjectAccessNone      ObjectAccess = 0
	ObjectAccessRead      ObjectAccess = 1
	ObjectAccessWrite     ObjectAccess = 2
	ObjectAccessReadWrite ObjectAccess = 3
)

type ObjectUnitNode

type ObjectUnitNode struct {
	*BaseArgumentNode
}

ObjectUnitNode a reference to a unit of an object (e.g. a column or field of a table).

<name_path> is a vector giving the identifier path of the object unit.

func (*ObjectUnitNode) AddNamePath

func (n *ObjectUnitNode) AddNamePath(v string)

func (*ObjectUnitNode) NamePath

func (n *ObjectUnitNode) NamePath() []string

func (*ObjectUnitNode) SetNamePath

func (n *ObjectUnitNode) SetNamePath(v []string)

type OptionNode

type OptionNode struct {
	*BaseArgumentNode
}

OptionNode represents one SQL hint key/value pair. The SQL syntax @{ key1=value1, key2=value2, some_db.key3=value3 } will expand to three OptionsNode. Keyword hints (e.g. LOOKUP JOIN) are interpreted as shorthand, and will be expanded to a OptionNode attached to the appropriate node before any explicit long-form hints.

OptionsNode are attached to the ScanNode corresponding to the operator that the SQL hint was associated with. Hint semantics are implementation defined.

Each hint is resolved as a [<qualifier>.]<name>:=<value> pair.

<qualifier> will be empty if no qualifier was present.
<name> is always non-empty.
<value> can be a LiteralNode or a ParameterNode,
        a cast of a ParameterNode (for typed hints only),
        or a general expression (on constant inputs).

If AllowedHintsAndOptions was set in AnalyzerOptions, and this hint or option was included there and had an expected type, the type of <value> will match that expected type. Unknown hints (not listed in AllowedHintsAndOptions) are not stripped and will still show up here.

If non-empty, <qualifier> should be interpreted as a target system name, and a database system should ignore any hints targeted to different systems.

The SQL syntax allows using an identifier as a hint value. Such values are stored here as LiteralNodes with string type.

func (*OptionNode) Name

func (n *OptionNode) Name() string

func (*OptionNode) Qualifier

func (n *OptionNode) Qualifier() string

func (*OptionNode) SetName

func (n *OptionNode) SetName(v string)

func (*OptionNode) SetQualifier

func (n *OptionNode) SetQualifier(v string)

func (*OptionNode) SetValue

func (n *OptionNode) SetValue(v ExprNode)

func (*OptionNode) Value

func (n *OptionNode) Value() ExprNode

type OrderByItemNode

type OrderByItemNode struct {
	*BaseArgumentNode
}

OrderByItemNode this represents one column of an ORDER BY clause, with the requested ordering direction.

<collation_name> is the ORDER BY COLLATE expression, and could be a string literal or query parameter. <collation_name> can only be set when the FEATURE_V_1_1_ORDER_BY_COLLATE is enabled. <collation> (only set when FEATURE_V_1_3_COLLATION_SUPPORT is enabled) is the derived collation to use. It comes from the <column_ref> and COLLATE clause. It is unset if COLLATE is present and set to a parameter. When both features are enabled, if <collation_name> is present and is - a parameter, then <collation> is empty - a non-parameter, then <collation> is set to the same collation An engine which supports both features could read the fields as:

If <collation> is set then use it, otherwise use <collation_name>, which
must be a query parameter if set.

<null_order> indicates the ordering of NULL values relative to non-NULL values. NULLS_FIRST indicates that NULLS sort prior to non-NULL values, and NULLS_LAST indicates that NULLS sort after non-NULL values.

func (*OrderByItemNode) Collation

func (n *OrderByItemNode) Collation() *Collation

func (*OrderByItemNode) CollationName

func (n *OrderByItemNode) CollationName() ExprNode

func (*OrderByItemNode) ColumnRef

func (n *OrderByItemNode) ColumnRef() *ColumnRefNode

func (*OrderByItemNode) IsDescending

func (n *OrderByItemNode) IsDescending() bool

func (*OrderByItemNode) NullOrder

func (n *OrderByItemNode) NullOrder() NullOrderMode

func (*OrderByItemNode) SetCollation

func (n *OrderByItemNode) SetCollation(v *Collation)

func (*OrderByItemNode) SetCollationName

func (n *OrderByItemNode) SetCollationName(v ExprNode)

func (*OrderByItemNode) SetColumnRef

func (n *OrderByItemNode) SetColumnRef(v *ColumnRefNode)

func (*OrderByItemNode) SetIsDescending

func (n *OrderByItemNode) SetIsDescending(v bool)

func (*OrderByItemNode) SetNullOrder

func (n *OrderByItemNode) SetNullOrder(v NullOrderMode)

type OrderByScanNode

type OrderByScanNode struct {
	*BaseScanNode
}

OrderByScanNode apply ordering to rows produced from input_scan, and output ordered rows.

The <order_by_item_list> must not be empty. Each element identifies a sort column and indicates direction (ascending or descending).

Order Preservation:

A ScanNode produces an ordered output if it has <is_ordered>=true.
If <is_ordered>=false, the scan may discard order.  This can happen
even for a OrderByScanNode, if it is the top-level scan in a
subquery (which discards order).

The following Scan nodes may have <is_ordered>=true, producing or propagating an ordering:

  • OrderByScanNode
  • LimitOffsetScanNode
  • ProjectScanNode
  • WithScanNode

Other Scan nodes will always discard ordering.

func (*OrderByScanNode) AddOrderByItem

func (n *OrderByScanNode) AddOrderByItem(v *OrderByItemNode)

func (*OrderByScanNode) InputScan

func (n *OrderByScanNode) InputScan() ScanNode

func (*OrderByScanNode) OrderByItemList

func (n *OrderByScanNode) OrderByItemList() []*OrderByItemNode

func (*OrderByScanNode) SetInputScan

func (n *OrderByScanNode) SetInputScan(v ScanNode)

func (*OrderByScanNode) SetOrderByItemList

func (n *OrderByScanNode) SetOrderByItemList(v []*OrderByItemNode)

type OutputColumnNode

type OutputColumnNode struct {
	*BaseArgumentNode
}

OutputColumnNode this is used in QueryStmtNode to provide a user-visible name for each output column.

func (*OutputColumnNode) Column

func (n *OutputColumnNode) Column() *Column

func (*OutputColumnNode) Name

func (n *OutputColumnNode) Name() string

func (*OutputColumnNode) SetColumn

func (n *OutputColumnNode) SetColumn(v *Column)

func (*OutputColumnNode) SetName

func (n *OutputColumnNode) SetName(v string)

type ParameterNode

type ParameterNode struct {
	*BaseExprNode
}

ParameterNode

func (*ParameterNode) IsUntyped

func (n *ParameterNode) IsUntyped() bool

IsUntyped if true, then the parameter has no specified type.

This exists mainly for resolver bookkeeping and should be ignored by engines.

func (*ParameterNode) Name

func (n *ParameterNode) Name() string

Name if non-empty, the name of the parameter.

A ParameterNode will have either a name or a position but not both.

func (*ParameterNode) Position

func (n *ParameterNode) Position() int

Position if non-zero, the 1-based position of the positional parameter.

A ParameterNode will have either a name or a position but not both.

func (*ParameterNode) SetIsUntyped

func (n *ParameterNode) SetIsUntyped(v bool)

func (*ParameterNode) SetName

func (n *ParameterNode) SetName(v string)

func (*ParameterNode) SetPosition

func (n *ParameterNode) SetPosition(v int)

type PivotColumnNode

type PivotColumnNode struct {
	*BaseArgumentNode
}

PivotColumnNode represents a column produced by aggregating a particular pivot expression over a subset of the input for which the FOR expression matches a particular pivot value. This aggregation is further broken up by the enclosing PivotScanNode's groupby columns, with each distinct value of the groupby columns producing a separate row in the output.

In any pivot column, 'c', 'c' is produced by aggregating pivot expression

<pivot_expr_list[c.pivot_expr_index]>

over input rows such that

<for_expr> IS NOT DISTINCT FROM
<pivot_value_list[c.pivot_value_index]>

func (*PivotColumnNode) Column

func (n *PivotColumnNode) Column() *Column

Column the output column used to represent the result of the pivot.

func (*PivotColumnNode) PivotExprIndex

func (n *PivotColumnNode) PivotExprIndex() int

PivotExprIndex specifies the index of the pivot expression within the enclosing PivotScanNode's <pivot_expr_list> used to determine the result of the column.

func (*PivotColumnNode) PivotValueIndex

func (n *PivotColumnNode) PivotValueIndex() int

PivotValueIndex specifies the index of the pivot value within the enclosing PivotScanNode's <pivot_value_list> used to determine the subset of input rows the pivot expression should be evaluated over.

func (*PivotColumnNode) SetColumn

func (n *PivotColumnNode) SetColumn(v *Column)

func (*PivotColumnNode) SetPivotExprIndex

func (n *PivotColumnNode) SetPivotExprIndex(v int)

func (*PivotColumnNode) SetPivotValueIndex

func (n *PivotColumnNode) SetPivotValueIndex(v int)

type PivotScanNode

type PivotScanNode struct {
	*BaseScanNode
}

PivotScanNode a scan produced by the following SQL fragment:

<input_scan> PIVOT(... FOR ... IN (...))

The column list of this scan consists of a subset of columns from <group_by_column_list> and <pivot_column_list>.

func (*PivotScanNode) AddGroupBy

func (n *PivotScanNode) AddGroupBy(v *ComputedColumnNode)

func (*PivotScanNode) AddPivotColumn

func (n *PivotScanNode) AddPivotColumn(v *PivotColumnNode)

func (*PivotScanNode) AddPivotExpr

func (n *PivotScanNode) AddPivotExpr(v ExprNode)

func (*PivotScanNode) AddPivotValue

func (n *PivotScanNode) AddPivotValue(v ExprNode)

func (*PivotScanNode) ForExpr

func (n *PivotScanNode) ForExpr() ExprNode

ForExpr expression following the FOR keyword, to be evaluated over each row in <input_scan>. This value is compared with each value in <pivot_value_list> to determine which columns the aggregation results of <pivot_expr_list> should go to.

func (*PivotScanNode) GroupByList

func (n *PivotScanNode) GroupByList() []*ComputedColumnNode

GroupByList the columns from <input_scan> to group by. The output will have one row for each distinct combination of values for all grouping columns. (There will be one output row if this list is empty.)

Each element is a ComputedColumnNode. The expression is always a ColumnRefNode that references a column from <input_scan>.

func (*PivotScanNode) InputScan

func (n *PivotScanNode) InputScan() ScanNode

InputScan input to the PIVOT clause.

func (*PivotScanNode) PivotColumnList

func (n *PivotScanNode) PivotColumnList() []*PivotColumnNode

PivotColumnList list of columns created to store the output pivot columns. Each is computed using one of pivot_expr_list and one of pivot_value_list.

func (*PivotScanNode) PivotExprList

func (n *PivotScanNode) PivotExprList() []ExprNode

PivotExprList pivot expressions which aggregate over the subset of <input_scan> where <for_expr> matches each value in <pivot_value_list>, plus all columns in <group_by_list>.

func (*PivotScanNode) PivotValueList

func (n *PivotScanNode) PivotValueList() []ExprNode

PivotValueList a list of pivot values within the IN list, to be compared against the result of <for_expr> for each row in the input table. Each pivot value generates a distinct column in the output for each pivot expression, representing the result of the corresponding pivot expression over the subset of input where <for_expr> matches this pivot value.

All pivot values in this list must have the same type as <for_expr> and must be constant.

func (*PivotScanNode) SetForExpr

func (n *PivotScanNode) SetForExpr(v ExprNode)

func (*PivotScanNode) SetGroupByList

func (n *PivotScanNode) SetGroupByList(v []*ComputedColumnNode)

func (*PivotScanNode) SetInputScan

func (n *PivotScanNode) SetInputScan(v ScanNode)

func (*PivotScanNode) SetPivotColumnList

func (n *PivotScanNode) SetPivotColumnList(v []*PivotColumnNode)

func (*PivotScanNode) SetPivotExprList

func (n *PivotScanNode) SetPivotExprList(v []ExprNode)

func (*PivotScanNode) SetPivotValueList

func (n *PivotScanNode) SetPivotValueList(v []ExprNode)

type PrimaryKeyNode

type PrimaryKeyNode struct {
	*BaseConstraintNode
}

PrimaryKeyNode this represents the PRIMARY KEY constraint on a table. <column_offset_list> provides the offsets of the column definitions that

comprise the primary key. This is empty when a
0-element primary key is defined or when the altered
table does not exist.

<unenforced> specifies whether the constraint is unenforced. <constraint_name> specifies the constraint name, if present <column_name_list> provides the column names used in column definitions

that comprise the primary key.

func (*PrimaryKeyNode) AddColumnName

func (n *PrimaryKeyNode) AddColumnName(v string)

func (*PrimaryKeyNode) AddColumnOffset

func (n *PrimaryKeyNode) AddColumnOffset(v int)

func (*PrimaryKeyNode) AddOption

func (n *PrimaryKeyNode) AddOption(v *OptionNode)

func (*PrimaryKeyNode) ColumnNameList

func (n *PrimaryKeyNode) ColumnNameList() []string

func (*PrimaryKeyNode) ColumnOffsetList

func (n *PrimaryKeyNode) ColumnOffsetList() []int

func (*PrimaryKeyNode) ConstraintName

func (n *PrimaryKeyNode) ConstraintName() string

func (*PrimaryKeyNode) OptionList

func (n *PrimaryKeyNode) OptionList() []*OptionNode

func (*PrimaryKeyNode) SetColumnNameList

func (n *PrimaryKeyNode) SetColumnNameList(v []string)

func (*PrimaryKeyNode) SetColumnOffsetList

func (n *PrimaryKeyNode) SetColumnOffsetList(v []int)

func (*PrimaryKeyNode) SetConstraintName

func (n *PrimaryKeyNode) SetConstraintName(v string)

func (*PrimaryKeyNode) SetOptionList

func (n *PrimaryKeyNode) SetOptionList(v []*OptionNode)

func (*PrimaryKeyNode) SetUnenforced

func (n *PrimaryKeyNode) SetUnenforced(v bool)

func (*PrimaryKeyNode) Unenforced

func (n *PrimaryKeyNode) Unenforced() bool

type PrivilegeNode

type PrivilegeNode struct {
	*BaseArgumentNode
}

PrivilegeNode a grantable privilege.

<action_type> is the type of privilege action, e.g. SELECT, INSERT, UPDATE or DELETE. <unit_list> is an optional list of units of the object (e.g. columns of a table, fields in a value table) that the privilege is scoped to. The privilege is on the whole object if the list is empty.

func (*PrivilegeNode) ActionType

func (n *PrivilegeNode) ActionType() string

func (*PrivilegeNode) AddUnit

func (n *PrivilegeNode) AddUnit(v *ObjectUnitNode)

func (*PrivilegeNode) SetActionType

func (n *PrivilegeNode) SetActionType(v string)

func (*PrivilegeNode) SetUnitList

func (n *PrivilegeNode) SetUnitList(v []*ObjectUnitNode)

func (*PrivilegeNode) UnitList

func (n *PrivilegeNode) UnitList() []*ObjectUnitNode

type ProjectScanNode

type ProjectScanNode struct {
	*BaseScanNode
}

ProjectScanNode a project node computes new expression values, and possibly drops columns from the input Scan's column_list.

Each entry in <expr_list> is a new column computed from an expression.

The column_list can include any columns from input_scan, plus these newly computed columns.

NOTE: This scan will propagate the is_ordered property of <input_scan> by default. To make this scan unordered, call set_is_ordered(false).

func (*ProjectScanNode) AddExpr

func (n *ProjectScanNode) AddExpr(v *ComputedColumnNode)

func (*ProjectScanNode) ExprList

func (n *ProjectScanNode) ExprList() []*ComputedColumnNode

func (*ProjectScanNode) InputScan

func (n *ProjectScanNode) InputScan() ScanNode

func (*ProjectScanNode) SetExprList

func (n *ProjectScanNode) SetExprList(v []*ComputedColumnNode)

func (*ProjectScanNode) SetInputScan

func (n *ProjectScanNode) SetInputScan(v ScanNode)

type QueryStmtNode

type QueryStmtNode struct {
	*BaseStatementNode
}

QueryStmtNode a SQL query statement. This is the outermost query statement that runs and produces rows of output, like a SELECT. (The contained query may be a Scan corresponding to a non-Select top-level operation like UNION ALL or WITH.)

<output_column_list> gives the user-visible column names that should be returned in the API or query tools. There may be duplicate names, and multiple output columns may reference the same column from <query>.

func (*QueryStmtNode) AddOutputColumn

func (n *QueryStmtNode) AddOutputColumn(v *OutputColumnNode)

func (*QueryStmtNode) IsValueTable

func (n *QueryStmtNode) IsValueTable() bool

IsValueTable if true, the result of this query is a value table. Rather than producing rows with named columns, it produces rows with a single unnamed value type. output_column_list will have exactly one column, with an empty name.

func (*QueryStmtNode) OutputColumnList

func (n *QueryStmtNode) OutputColumnList() []*OutputColumnNode

func (*QueryStmtNode) Query

func (n *QueryStmtNode) Query() ScanNode

func (*QueryStmtNode) SetIsValueTable

func (n *QueryStmtNode) SetIsValueTable(v bool)

func (*QueryStmtNode) SetOutputColumnList

func (n *QueryStmtNode) SetOutputColumnList(v []*OutputColumnNode)

func (*QueryStmtNode) SetQuery

func (n *QueryStmtNode) SetQuery(v ScanNode)

type ReadWriteMode

type ReadWriteMode int
const (
	ReadWriteModeUnspecified ReadWriteMode = 0
	ReadWriteModeReadOnly    ReadWriteMode = 1
	ReadWriteModeReadWrite   ReadWriteMode = 2
)

type RecursiveRefScanNode

type RecursiveRefScanNode struct {
	*BaseScanNode
}

RecursiveRefScanNode scan the previous iteration of the recursive alias currently being defined, from inside the recursive subquery which defines it. Such nodes can exist only in the recursive term of a RecursiveScanNode node. The column_list produced here will match 1:1 with the column_list produced by the referenced subquery and will be given a new unique name to each column produced for this scan.

type RecursiveScanNode

type RecursiveScanNode struct {
	*BaseScanNode
}

RecursiveScanNode a recursive query inside a WITH RECURSIVE or RECURSIVE VIEW. A RecursiveScanNode may appear in a resolved tree only as a top-level input scan of a WithEntryNode or BaseCreateViewNode.

Recursive queries must satisfy the form:

<non-recursive-query> UNION [ALL|DISTINCT] <recursive-query>

where self-references to table being defined are allowed only in the <recursive-query> section.

<column_list> is a set of new ColumnsNode created by this scan. Each input SetOperationItemNode has an <output_column_list> which matches 1:1 with <column_list> and specifies how the input <scan>'s columns map into the final <column_list>.

At runtime, a recursive scan is evaluated using an iterative process:

Step 1: Evaluate the non-recursive term. If UNION DISTINCT

is specified, discard duplicates.

Step 2:

Repeat until step 2 produces an empty result:
  Evaluate the recursive term, binding the recursive table to the
  new rows produced by previous step. If UNION DISTINCT is specified,
  discard duplicate rows, as well as any rows which match any
  previously-produced result.

Step 3:

The final content of the recursive table is the UNION ALL of all results
produced (step 1, plus all iterations of step 2).

RecursiveScanNode only supports a recursive WITH entry which

directly references itself; ZetaSQL does not support mutual recursion
between multiple with-clause elements.

func (*RecursiveScanNode) NonRecursiveTerm

func (n *RecursiveScanNode) NonRecursiveTerm() *SetOperationItemNode

func (*RecursiveScanNode) OpType

func (*RecursiveScanNode) RecursiveTerm

func (n *RecursiveScanNode) RecursiveTerm() *SetOperationItemNode

func (*RecursiveScanNode) SetNonRecursiveTerm

func (n *RecursiveScanNode) SetNonRecursiveTerm(v *SetOperationItemNode)

func (*RecursiveScanNode) SetOpType

func (*RecursiveScanNode) SetRecursiveTerm

func (n *RecursiveScanNode) SetRecursiveTerm(v *SetOperationItemNode)

type RecursiveSetOperationType

type RecursiveSetOperationType int
const (
	RecursiveSetOperationTypeUnionAll      RecursiveSetOperationType = 0
	RecursiveSetOperationTypeUnionDistinct RecursiveSetOperationType = 1
)

type RelationArgumentScanNode

type RelationArgumentScanNode struct {
	*BaseScanNode
}

RelationArgumentScanNode this represents a relation argument reference in a table-valued function's body. The 'column_list' of this ScanNode includes column names from the relation argument in the table-valued function signature.

func (*RelationArgumentScanNode) IsValueTable

func (n *RelationArgumentScanNode) IsValueTable() bool

IsValueTable if true, the result of this query is a value table. Rather than producing rows with named columns, it produces rows with a single unnamed value type.

func (*RelationArgumentScanNode) Name

func (n *RelationArgumentScanNode) Name() string

Name this is the name of the relation argument for the table-valued function. It is used to match this relation argument reference in a TVF SQL function body with one of possibly several relation arguments in the TVF call.

func (*RelationArgumentScanNode) SetIsValueTable

func (n *RelationArgumentScanNode) SetIsValueTable(v bool)

func (*RelationArgumentScanNode) SetName

func (n *RelationArgumentScanNode) SetName(v string)

type RemoveFromRestricteeListActionNode

type RemoveFromRestricteeListActionNode struct {
	*BaseAlterActionNode
}

RemoveFromRestricteeListActionNode this action for ALTER PRIVILEGE RESTRICTION statement:

REMOVE [IF EXISTS] <restrictee_list>

<restrictee_list> is a list of users and groups the privilege restrictions

should apply to. Each restrictee is either a string
literal or a parameter.

func (*RemoveFromRestricteeListActionNode) AddRestrictee

func (n *RemoveFromRestricteeListActionNode) AddRestrictee(v ExprNode)

func (*RemoveFromRestricteeListActionNode) IsIfExists

func (n *RemoveFromRestricteeListActionNode) IsIfExists() bool

func (*RemoveFromRestricteeListActionNode) RestricteeList

func (n *RemoveFromRestricteeListActionNode) RestricteeList() []ExprNode

func (*RemoveFromRestricteeListActionNode) SetIsIfExists

func (n *RemoveFromRestricteeListActionNode) SetIsIfExists(v bool)

func (*RemoveFromRestricteeListActionNode) SetRestricteeList

func (n *RemoveFromRestricteeListActionNode) SetRestricteeList(v []ExprNode)

type RenameColumnActionNode

type RenameColumnActionNode struct {
	*BaseAlterActionNode
}

RenameColumnActionNode RENAME COLUMN action for ALTER TABLE statement.

<name> is the name of the column to rename. <new_name> is the new name of the column.

RENAME COLUMN actions cannot be part of the same alter_action_list as any other type of action. Chains of RENAME COLUMN will be interpreted as a sequence of mutations. The order of actions matters. Each <name> refers to a column name that exists after all preceding renames have been applied.

func (*RenameColumnActionNode) IsIfExists

func (n *RenameColumnActionNode) IsIfExists() bool

func (*RenameColumnActionNode) Name

func (n *RenameColumnActionNode) Name() string

func (*RenameColumnActionNode) NewName

func (n *RenameColumnActionNode) NewName() string

func (*RenameColumnActionNode) SetIsIfExists

func (n *RenameColumnActionNode) SetIsIfExists(v bool)

func (*RenameColumnActionNode) SetName

func (n *RenameColumnActionNode) SetName(v string)

func (*RenameColumnActionNode) SetNewName

func (n *RenameColumnActionNode) SetNewName(v string)

type RenameStmtNode

type RenameStmtNode struct {
	*BaseStatementNode
}

RenameStmtNode this statement: RENAME <object_type> <old_name_path> TO <new_name_path>;

<object_type> is an string identifier,

e.g., "TABLE", "VIEW", "INDEX", "FUNCTION", "TYPE", etc.

<old_name_path> is a vector giving the identifier path for the object to

be renamed.

<new_name_path> is a vector giving the identifier path for the object to

be renamed to.

func (*RenameStmtNode) AddNewName

func (n *RenameStmtNode) AddNewName(v string)

func (*RenameStmtNode) AddOldNamePath

func (n *RenameStmtNode) AddOldNamePath(v string)

func (*RenameStmtNode) NewNamePath

func (n *RenameStmtNode) NewNamePath() []string

func (*RenameStmtNode) ObjectType

func (n *RenameStmtNode) ObjectType() string

func (*RenameStmtNode) OldNamePath

func (n *RenameStmtNode) OldNamePath() []string

func (*RenameStmtNode) SetNewNamePath

func (n *RenameStmtNode) SetNewNamePath(v []string)

func (*RenameStmtNode) SetObjectType

func (n *RenameStmtNode) SetObjectType(v string)

func (*RenameStmtNode) SetOldNamePath

func (n *RenameStmtNode) SetOldNamePath(v []string)

type RenameToActionNode

type RenameToActionNode struct {
	*BaseAlterActionNode
}

RenameToActionNode RENAME TO action for ALTER ROW ACCESS POLICY statement

and ALTER TABLE statement

<new_path> is the new name of the row access policy,

or the new path of the table.

func (*RenameToActionNode) AddNewPath

func (n *RenameToActionNode) AddNewPath(v string)

func (*RenameToActionNode) NewPath

func (n *RenameToActionNode) NewPath() []string

func (*RenameToActionNode) SetNewPath

func (n *RenameToActionNode) SetNewPath(v []string)

type ReplaceFieldItemNode

type ReplaceFieldItemNode struct {
	*BaseArgumentNode
}

ReplaceFieldItemNode an argument to the REPLACE_FIELDS() function which specifies a field path and a value that this field will be set to. The field path to be modified can be constructed through the StructIndexPath and ProtoFieldPath fields. These vectors correspond to field paths in a STRUCT and PROTO, respectively. At least one of these vectors must be non-empty.

If only StructIndexPath is non-empty, then the field path only references top-level and nested struct fields.

If only ProtoFieldPath is non-empty, then the field path only references top-level and nested message fields.

If both StructIndexPath and ProtoFieldPath are non-empty, then the field path should be expanded starting with StructIndexPath. The last field in StructIndexPath will be the proto from which the first field in ProtoFieldPath is extracted.

Expr and the field to be modified must be the same type.

func (*ReplaceFieldItemNode) AddStructIndexPath

func (n *ReplaceFieldItemNode) AddStructIndexPath(v int)

func (*ReplaceFieldItemNode) Expr

func (n *ReplaceFieldItemNode) Expr() ExprNode

Expr the value that the final field in <proto_field_path> will be set to.

If <expr> is NULL, the field will be unset. If <proto_field_path> is a required field, the engine must return an error if it is set to NULL.

func (*ReplaceFieldItemNode) SetExpr

func (n *ReplaceFieldItemNode) SetExpr(v ExprNode)

func (*ReplaceFieldItemNode) SetStructIndexPath

func (n *ReplaceFieldItemNode) SetStructIndexPath(v []int)

func (*ReplaceFieldItemNode) StructIndexPath

func (n *ReplaceFieldItemNode) StructIndexPath() []int

StructIndexPath a vector of integers that denotes the path to a struct field that will be modified. The integer values in this vector correspond to field positions (0-based) in a STRUCT. If <proto_field_path> is also non-empty, then the field corresponding to the last index in this vector should be of proto type.

type ReplaceFieldNode

type ReplaceFieldNode struct {
	*BaseExprNode
}

ReplaceFieldNode represents a call to the REPLACE_FIELDS() function. This function can be used to copy a proto or struct, modify a few fields and output the resulting proto or struct. The SQL syntax for this function is REPLACE_FIELDS(<expr>, <replace_field_item_list>).

func (*ReplaceFieldNode) AddReplaceFieldItem

func (n *ReplaceFieldNode) AddReplaceFieldItem(v *ReplaceFieldItemNode)

func (*ReplaceFieldNode) Expr

func (n *ReplaceFieldNode) Expr() ExprNode

Expr the proto/struct to modify.

func (*ReplaceFieldNode) ReplaceFieldItemList

func (n *ReplaceFieldNode) ReplaceFieldItemList() []*ReplaceFieldItemNode

ReplaceFieldItemList the list of field paths to be modified along with their new values.

Engines must check at evaluation time that the modifications in ReplaceFieldItemList obey the following rules regarding updating protos in ZetaSQL: - Modifying a subfield of a NULL-valued proto-valued field is an error. - Clearing a required field or subfield is an error.

func (*ReplaceFieldNode) SetExpr

func (n *ReplaceFieldNode) SetExpr(v ExprNode)

func (*ReplaceFieldNode) SetReplaceFieldItemList

func (n *ReplaceFieldNode) SetReplaceFieldItemList(v []*ReplaceFieldItemNode)

type RestrictToActionNode

type RestrictToActionNode struct {
	*BaseAlterActionNode
}

RestrictToActionNode this action for ALTER PRIVILEGE RESTRICTION statement:

RESTRICT TO <restrictee_list>

<restrictee_list> is a list of users and groups the privilege restrictions

should apply to. Each restrictee is either a string
literal or a parameter.

func (*RestrictToActionNode) AddRestrictee

func (n *RestrictToActionNode) AddRestrictee(v ExprNode)

func (*RestrictToActionNode) RestricteeList

func (n *RestrictToActionNode) RestricteeList() []ExprNode

func (*RestrictToActionNode) SetRestricteeList

func (n *RestrictToActionNode) SetRestricteeList(v []ExprNode)

type ReturningClauseNode

type ReturningClauseNode struct {
	*BaseArgumentNode
}

ReturningClauseNode represents the returning clause on a DML statement.

func (*ReturningClauseNode) ActionColumn

func (n *ReturningClauseNode) ActionColumn() *ColumnHolderNode

ActionColumn represents the WITH ACTION column in <output_column_list> as a string type column. There are four valid values for this action column: "INSERT", "REPLACE", "UPDATE", and "DELETE".

func (*ReturningClauseNode) AddExpr

func (n *ReturningClauseNode) AddExpr(v *ComputedColumnNode)

func (*ReturningClauseNode) AddOutputColumn

func (n *ReturningClauseNode) AddOutputColumn(v *OutputColumnNode)

func (*ReturningClauseNode) ExprList

func (n *ReturningClauseNode) ExprList() []*ComputedColumnNode

ExprList represents the computed expressions so they can be referenced in <output_column_list>. Worth noting, it can't see <action_column> and can only access columns from the DML statement target table.

func (*ReturningClauseNode) OutputColumnList

func (n *ReturningClauseNode) OutputColumnList() []*OutputColumnNode

OutputColumnList specifies the columns in the returned output row with column names. It can reference columns from the target table scan <table_scan> from INSERT/DELETE/UPDATE statements. Also this list can have columns computed in the <expr_list> or an <action_column> as the last column.

func (*ReturningClauseNode) SetActionColumn

func (n *ReturningClauseNode) SetActionColumn(v *ColumnHolderNode)

func (*ReturningClauseNode) SetExprList

func (n *ReturningClauseNode) SetExprList(v []*ComputedColumnNode)

func (*ReturningClauseNode) SetOutputColumnList

func (n *ReturningClauseNode) SetOutputColumnList(v []*OutputColumnNode)

type RevokeFromActionNode

type RevokeFromActionNode struct {
	*BaseAlterActionNode
}

RevokeFromActionNode REVOKE FROM action for ALTER ROW ACCESS POLICY statement

<revokee_expr_list> is the list of revokees, and may include parameters. <is_revoke_from_all> is a boolean indicating whether it was a REVOKE FROM

ALL statement.

func (*RevokeFromActionNode) AddRevokeeExpr

func (n *RevokeFromActionNode) AddRevokeeExpr(v ExprNode)

func (*RevokeFromActionNode) IsRevokeFromAll

func (n *RevokeFromActionNode) IsRevokeFromAll() bool

func (*RevokeFromActionNode) RevokeeExprList

func (n *RevokeFromActionNode) RevokeeExprList() []ExprNode

func (*RevokeFromActionNode) SetIsRevokeFromAll

func (n *RevokeFromActionNode) SetIsRevokeFromAll(v bool)

func (*RevokeFromActionNode) SetRevokeeExprList

func (n *RevokeFromActionNode) SetRevokeeExprList(v []ExprNode)

type RevokeStmtNode

type RevokeStmtNode struct {
	*GrantOrRevokeStmtNode
}

RevokeStmtNode a REVOKE statement. It represents the action to revoke a list of privileges on a specific object to/from list of grantees.

type RollbackStmtNode

type RollbackStmtNode struct {
	*BaseStatementNode
}

RollbackStmtNode this statement: ROLLBACK [TRANSACTION];

type RunBatchStmtNode

type RunBatchStmtNode struct {
	*BaseStatementNode
}

RunBatchStmtNode this statement: RUN BATCH;

type SQLSecurity

type SQLSecurity int
const (
	SQLSecurityUnspecified SQLSecurity = 0
	SQLSecurityDefiner     SQLSecurity = 1
	SQLSecurityInvoker     SQLSecurity = 2
)

type SampleScanNode

type SampleScanNode struct {
	*BaseScanNode
}

SampleScanNode samples rows from <input_scan>. Specs for WITH WEIGHT and PARTITION BY

<method> is the identifier for the sampling algorithm and will always be in lowercase. For example BERNOULLI, RESERVOIR, SYSTEM. Engines can also support their own implementation-specific set of sampling algorithms.

<size> and <unit> specifies the sample size. If <unit> is "ROWS", <size> must be an <int64> and non-negative. If <unit> is "PERCENT", <size> must either be a <double> or an <int64> and in the range [0, 100]. <size> can only be a literal value or a (possibly casted) parameter.

<repeatable_argument> is present if we had a REPEATABLE(<argument>) in the TABLESAMPLE clause and can only be a literal value or a (possibly casted) parameter.

If present, <weight_column> defines the column produced by this scan that stores the scaling weight for the corresponding sampled row.

<partition_by_list> can be empty. If <partition_by_list> is not empty, <unit> must be ROWS and <method> must be RESERVOIR.

func (*SampleScanNode) AddPartitionBy

func (n *SampleScanNode) AddPartitionBy(v ExprNode)

func (*SampleScanNode) InputScan

func (n *SampleScanNode) InputScan() ScanNode

func (*SampleScanNode) Method

func (n *SampleScanNode) Method() string

func (*SampleScanNode) PartitionByList

func (n *SampleScanNode) PartitionByList() []ExprNode

func (*SampleScanNode) RepeatableArgument

func (n *SampleScanNode) RepeatableArgument() ExprNode

func (*SampleScanNode) SetInputScan

func (n *SampleScanNode) SetInputScan(v ScanNode)

func (*SampleScanNode) SetMethod

func (n *SampleScanNode) SetMethod(v string)

func (*SampleScanNode) SetPartitionByList

func (n *SampleScanNode) SetPartitionByList(v []ExprNode)

func (*SampleScanNode) SetRepeatableArgument

func (n *SampleScanNode) SetRepeatableArgument(v ExprNode)

func (*SampleScanNode) SetSize

func (n *SampleScanNode) SetSize(v ExprNode)

func (*SampleScanNode) SetUnit

func (n *SampleScanNode) SetUnit(v SampleUnit)

func (*SampleScanNode) SetWeightColumn

func (n *SampleScanNode) SetWeightColumn(v *ColumnHolderNode)

func (*SampleScanNode) Size

func (n *SampleScanNode) Size() ExprNode

func (*SampleScanNode) Unit

func (n *SampleScanNode) Unit() SampleUnit

func (*SampleScanNode) WeightColumn

func (n *SampleScanNode) WeightColumn() *ColumnHolderNode

type SampleUnit

type SampleUnit int
const (
	SampleUnitRows    SampleUnit = 0
	SampleUnitPercent SampleUnit = 1
)

type ScanNode

type ScanNode interface {
	Node
	ColumnList() []*Column
	SetColumnList([]*Column)
	AddColumn(*Column)
	HintList() []*OptionNode
	SetHintList([]*OptionNode)
	AddHint(*OptionNode)
	IsOrdered() bool
	SetIsOrdered(bool)
}

ScanNode common interface for all Scans, which are nodes that produce rows (e.g. scans, joins, table subqueries). A query's FROM clause is represented as a single Scan that composes all input sources into a single row stream.

Each Scan has a <column_list> that says what columns are produced. The Scan logically produces a stream of output rows, where each row has exactly these columns.

Each Scan may have an attached <hint_list>, storing each hint as a OptionNode.

If <is_ordered> is true, this Scan produces an ordered output, either by generating order itself (OrderByScan) or by preserving the order of its single input scan (LimitOffsetScan, ProjectScan, or WithScan).

type SetAsActionNode

type SetAsActionNode struct {
	*BaseAlterActionNode
}

SetAsActionNode SET AS action for generic ALTER <entity_type> statement. Exactly one of <entity_body_json>, <entity_body_text> should be non-empty.

<entity_body_json> is a JSON literal to be interpreted by engine. <entity_body_text> is a text literal to be interpreted by engine.

func (*SetAsActionNode) EntityBodyJSON

func (n *SetAsActionNode) EntityBodyJSON() string

func (*SetAsActionNode) EntityBodyText

func (n *SetAsActionNode) EntityBodyText() string

func (*SetAsActionNode) SetEntityBodyJSON

func (n *SetAsActionNode) SetEntityBodyJSON(v string)

func (*SetAsActionNode) SetEntityBodyText

func (n *SetAsActionNode) SetEntityBodyText(v string)

type SetCollateClauseNode

type SetCollateClauseNode struct {
	*BaseAlterActionNode
}

SetCollateClauseNode SET DEFAULT COLLATE clause for generic ALTER <entity_type> statement.

<collation_name> specifies the new default collation specification for a

table or schema. Modifying the default collation for a table or schema
does not affect any existing columns or tables - the new default
collation only affects new tables and/or columns if applicable. Only
string literals are allowed for this field.

func (*SetCollateClauseNode) CollationName

func (n *SetCollateClauseNode) CollationName() ExprNode

func (*SetCollateClauseNode) SetCollationName

func (n *SetCollateClauseNode) SetCollationName(v ExprNode)

type SetOperationItemNode

type SetOperationItemNode struct {
	*BaseArgumentNode
}

SetOperationItemNode this is one input item in a SetOperationNode. The <output_column_list> matches 1:1 with the SetOperationNode's <column_list> and specifies how columns from <scan> map to output columns. Each column from <scan> can map to zero or more output columns.

func (*SetOperationItemNode) AddOutputColumn

func (n *SetOperationItemNode) AddOutputColumn(v *Column)

func (*SetOperationItemNode) OutputColumnList

func (n *SetOperationItemNode) OutputColumnList() []*Column

func (*SetOperationItemNode) Scan

func (n *SetOperationItemNode) Scan() ScanNode

func (*SetOperationItemNode) SetOutputColumnList

func (n *SetOperationItemNode) SetOutputColumnList(v []*Column)

func (*SetOperationItemNode) SetScan

func (n *SetOperationItemNode) SetScan(v ScanNode)

type SetOperationScanNode

type SetOperationScanNode struct {
	*BaseScanNode
}

SetOperationScanNode apply a set operation (specified by <op_type>) on two or more input scans.

<scan_list> will have at least two elements.

<column_list> is a set of new ColumnsNode created by this scan. Each input SetOperationItemNode has an <output_column_list> which matches 1:1 with <column_list> and specifies how the input <scan>'s columns map into the final <column_list>.

  • Results of {UNION, INTERSECT, EXCEPT} ALL can include duplicate rows. More precisely, with two input scans, if a given row R appears exactly m times in first input and n times in second input (m >= 0, n >= 0): For UNION ALL, R will appear exactly m + n times in the result. For INTERSECT ALL, R will appear exactly min(m, n) in the result. For EXCEPT ALL, R will appear exactly max(m - n, 0) in the result.
  • Results of {UNION, INTERSECT, EXCEPT} DISTINCT cannot contain any duplicate rows. For UNION and INTERSECT, the DISTINCT is computed after the result above is computed. For EXCEPT DISTINCT, row R will appear once in the output if m > 0 and n = 0.
  • For n (>2) input scans, the above operations generalize so the output is the same as if the inputs were combined incrementally from left to right.

func (*SetOperationScanNode) AddInputItem

func (n *SetOperationScanNode) AddInputItem(v *SetOperationItemNode)

func (*SetOperationScanNode) InputItemList

func (n *SetOperationScanNode) InputItemList() []*SetOperationItemNode

func (*SetOperationScanNode) OpType

func (*SetOperationScanNode) SetInputItemList

func (n *SetOperationScanNode) SetInputItemList(v []*SetOperationItemNode)

func (*SetOperationScanNode) SetOpType

func (n *SetOperationScanNode) SetOpType(v SetOperationType)

type SetOperationType

type SetOperationType int
const (
	SetOperationTypeUnionAll          SetOperationType = 0
	SetOperationTypeUnionDistinct     SetOperationType = 1
	SetOperationTypeIntersectAll      SetOperationType = 2
	SetOperationTypeIntersectDistinct SetOperationType = 3
	SetOperationTypeExceptAll         SetOperationType = 4
	SetOperationTypeExceptDistinct    SetOperationType = 5
)

type SetOptionsActionNode

type SetOptionsActionNode struct {
	*BaseAlterActionNode
}

SetOptionsActionNode SET OPTIONS action for ALTER <object> statement

<option_list> has engine-specific directives that specify how to

alter the metadata for this object.

func (*SetOptionsActionNode) AddOption

func (n *SetOptionsActionNode) AddOption(v *OptionNode)

func (*SetOptionsActionNode) OptionList

func (n *SetOptionsActionNode) OptionList() []*OptionNode

func (*SetOptionsActionNode) SetOptionList

func (n *SetOptionsActionNode) SetOptionList(v []*OptionNode)

type SetTransactionStmtNode

type SetTransactionStmtNode struct {
	*BaseStatementNode
}

SetTransactionStmtNode this statement: SET TRANSACTION <transaction_mode> [, ...]

Where transaction_mode is one of:

READ ONLY
READ WRITE
<isolation_level>

<isolation_level> is a string vector storing the identifiers after

ISOLATION LEVEL. The strings inside vector could be one of the
SQL standard isolation levels:

            READ UNCOMMITTED
            READ COMMITTED
            READ REPEATABLE
            SERIALIZABLE

or could be arbitrary strings. ZetaSQL does not validate that
the string is valid.

func (*SetTransactionStmtNode) AddIsolationLevel

func (n *SetTransactionStmtNode) AddIsolationLevel(v string)

func (*SetTransactionStmtNode) IsolationLevelList

func (n *SetTransactionStmtNode) IsolationLevelList() []string

func (*SetTransactionStmtNode) ReadWriteMode

func (n *SetTransactionStmtNode) ReadWriteMode() ReadWriteMode

func (*SetTransactionStmtNode) SetIsolationLevelList

func (n *SetTransactionStmtNode) SetIsolationLevelList(v []string)

func (*SetTransactionStmtNode) SetReadWriteMode

func (n *SetTransactionStmtNode) SetReadWriteMode(v ReadWriteMode)

type ShowStmtNode

type ShowStmtNode struct {
	*BaseStatementNode
}

ShowStmtNode this statement: SHOW <identifier> [FROM <name_path>] [LIKE <like_expr>];

<identifier> is a string that determines the type of objects to be shown,

e.g., TABLES, COLUMNS, INDEXES, STATUS,

<name_path> is an optional path to an object from which <identifier>

objects will be shown, e.g., if <identifier> = INDEXES and
<name> = table_name, the indexes of "table_name" will be shown.

<like_expr> is an optional LiteralNode of type string that if present

restricts the objects shown to have a name like this string.

func (*ShowStmtNode) AddNamePath

func (n *ShowStmtNode) AddNamePath(v string)

func (*ShowStmtNode) Identifier

func (n *ShowStmtNode) Identifier() string

func (*ShowStmtNode) LikeExpr

func (n *ShowStmtNode) LikeExpr() *LiteralNode

func (*ShowStmtNode) NamePath

func (n *ShowStmtNode) NamePath() []string

func (*ShowStmtNode) SetIdentifier

func (n *ShowStmtNode) SetIdentifier(v string)

func (*ShowStmtNode) SetLikeExpr

func (n *ShowStmtNode) SetLikeExpr(v *LiteralNode)

func (*ShowStmtNode) SetNamePath

func (n *ShowStmtNode) SetNamePath(v []string)

type SingleRowScanNode

type SingleRowScanNode struct {
	*BaseScanNode
}

SingleRowScanNode scan that produces a single row with no columns. Used for queries without a FROM clause, where all output comes from the select list.

type StartBatchStmtNode

type StartBatchStmtNode struct {
	*BaseStatementNode
}

StartBatchStmtNode this statement: START BATCH [<batch_type>];

<batch_type> is an optional string identifier that identifies the type of

the batch. (e.g. "DML" or "DDL)

func (*StartBatchStmtNode) BatchType

func (n *StartBatchStmtNode) BatchType() string

func (*StartBatchStmtNode) SetBatchType

func (n *StartBatchStmtNode) SetBatchType(v string)

type StatementNode

type StatementNode interface {
	Node
	HintList() []*OptionNode
	SetHintList(v []*OptionNode)
	AddHint(v *OptionNode)
}

StatementNode the base node of all ZetaSQL statements.

type StoredMode

type StoredMode int
const (
	StoredModeNonStored      StoredMode = 0
	StoredModeStored         StoredMode = 1
	StoredModeStoredVolatile StoredMode = 2
)

type SubqueryExprNode

type SubqueryExprNode struct {
	*BaseExprNode
}

SubqueryExprNode a subquery in an expression (not a FROM clause). The subquery runs in the context of a single input row and produces a single output value.

Correlated subqueries can be thought of like functions, with a parameter list. The ParameterList gives the set of ColumnsNode from outside the subquery that are used inside.

Inside the subquery, the only allowed references to values outside the subquery are to the named ColumnRefs listed in ParameterList. Any reference to one of these parameters will be represented as a ColumnRefNode with isCorrelated set to true.

These parameters are only visible through one level of expression subquery. An expression subquery inside an expression has to list parameters again if parameters from the outer query are passed down further. (This does not apply for table subqueries inside an expression subquery. Table subqueries are never indicated in the resolved AST, so Scan nodes inside an expression query may have come from a nested table subquery, and they can still reference the expression subquery's parameters.)

An empty ParameterList means that the subquery is uncorrelated. It is permissable to run an uncorrelated subquery only once and reuse the result. TODO Do we want to specify semantics more firmly here?

The semantics vary based on SubqueryType:

 SCALAR
   Usage: ( <subquery> )
   If the subquery produces zero rows, the output value is NULL.
   If the subquery produces exactly one row, that row is the output value.
   If the subquery produces more than one row, raise a runtime error.

 ARRAY
   Usage: ARRAY( <subquery> )
   The subquery produces an array value with zero or more rows, with
   one array element per subquery row produced.

 EXISTS
   Usage: EXISTS( <subquery> )
   The output type is always bool.  The result is true if the subquery
   produces at least one row, and false otherwise.

 IN
   Usage: <in_expr> [NOT] IN ( <subquery> )
   The output type is always bool.  The result is true when <in_expr> is
   equal to at least one row, and false otherwise.  The <subquery> row
   contains only one column, and the types of <in_expr> and the
   subquery column must exactly match a built-in signature for the
   '$equals' comparison function (they must be the same type or one
   must be INT64 and the other UINT64).  NOT will be expressed as a $not
   FunctionCall wrapping this SubqueryExpr.

LIKE
   Usage: <in_expr> [NOT] LIKE ANY|SOME|ALL ( <subquery> )
   The output type is always bool. The result is true when <in_expr>
   matches at least one row for LIKE ANY|SOME or matches all rows for
   LIKE ALL, and false otherwise.  The <subquery> row contains only one
   column, and the types of <in_expr> and the subquery column must
   exactly match a built-in signature for the relevant '$like_any' or
   '$like_all' comparison function (both must be the same type of either
   STRING or BYTES).  NOT will be expressed as a $not FunctionCall
   wrapping this SubqueryExpr.

The subquery for a SCALAR, ARRAY, IN or LIKE subquery must have exactly one output column. The output type for a SCALAR or ARRAY subquery is that column's type or an array of that column's type. (The subquery scan may include a Project with a MakeStruct or MakeProto expression to construct a single value from multiple columns.)

func (*SubqueryExprNode) AddHint

func (n *SubqueryExprNode) AddHint(v *OptionNode)

func (*SubqueryExprNode) AddParameter

func (n *SubqueryExprNode) AddParameter(v *ColumnRefNode)

func (*SubqueryExprNode) HintList

func (n *SubqueryExprNode) HintList() []*OptionNode

HintList NOTE: Hints currently happen only for EXISTS, IN, or a LIKE expression subquery but not for ARRAY or SCALAR subquery.

func (*SubqueryExprNode) InCollation

func (n *SubqueryExprNode) InCollation() *Collation

InCollation field is only populated for subqueries of type IN to specify the operation collation to use to compare <in_expr> with the rows from <subquery>.

func (*SubqueryExprNode) InExpr

func (n *SubqueryExprNode) InExpr() ExprNode

InExpr field is only populated for subqueries of type IN or LIKE ANY|SOME|ALL.

func (*SubqueryExprNode) ParameterList

func (n *SubqueryExprNode) ParameterList() []*ColumnRefNode

func (*SubqueryExprNode) SetHintList

func (n *SubqueryExprNode) SetHintList(v []*OptionNode)

func (*SubqueryExprNode) SetInCollation

func (n *SubqueryExprNode) SetInCollation(v *Collation)

func (*SubqueryExprNode) SetInExpr

func (n *SubqueryExprNode) SetInExpr(v ExprNode)

func (*SubqueryExprNode) SetParameterList

func (n *SubqueryExprNode) SetParameterList(v []*ColumnRefNode)

func (*SubqueryExprNode) SetSubquery

func (n *SubqueryExprNode) SetSubquery(v ScanNode)

func (*SubqueryExprNode) SetSubqueryType

func (n *SubqueryExprNode) SetSubqueryType(v SubqueryType)

func (*SubqueryExprNode) Subquery

func (n *SubqueryExprNode) Subquery() ScanNode

func (*SubqueryExprNode) SubqueryType

func (n *SubqueryExprNode) SubqueryType() SubqueryType

type SubqueryType

type SubqueryType int
const (
	SubqueryTypeScalar  SubqueryType = 0
	SubqueryTypeArray   SubqueryType = 1
	SubqueryTypeExists  SubqueryType = 2
	SubqueryTypeIn      SubqueryType = 3
	SubqueryTypeLikeAny SubqueryType = 4
	SubqueryTypeLikeAll SubqueryType = 5
)

type SystemVariableNode

type SystemVariableNode struct {
	*BaseExprNode
}

SystemVariableNode reference to a system variable.

func (*SystemVariableNode) AddNamePath

func (n *SystemVariableNode) AddNamePath(v string)

func (*SystemVariableNode) NamePath

func (n *SystemVariableNode) NamePath() []string

NamePath path to system variable.

func (*SystemVariableNode) SetNamePath

func (n *SystemVariableNode) SetNamePath(v []string)

type TVFArgumentNode

type TVFArgumentNode = FunctionArgumentNode

type TVFScanNode

type TVFScanNode struct {
	*BaseScanNode
}

TVFScanNode this scan represents a call to a table-valued function (TVF). Each TVF returns an entire output relation instead of a single scalar value. The enclosing query may refer to the TVF as if it were a table subquery. The TVF may accept scalar arguments and/or other input relations.

Scalar arguments work the same way as arguments for non-table-valued functions: in the resolved AST, their types are equal to the required argument types specified in the function signature.

The function signature may also include relation arguments, and any such relation argument may specify a required schema. If such a required schema is present, then in the resolved AST, the ScanNode for each relational FunctionArgumentNode is guaranteed to have the same number of columns as the required schema, and the provided columns match position-wise with the required columns. Each provided column has the same name and type as the corresponding required column.

If AnalyzerOptions::prune_unused_columns is true, the <column_list> and <column_index_list> will include only columns that were referenced in the user query. (SELECT * counts as referencing all columns.) Pruning has no effect on value tables (the value is never pruned).

<column_list> is a set of new ColumnsNode created by this scan. The <column_list>[i] should be matched to the related TVFScan's output relation column by <signature>.result_schema().column(<column_index_list>[i]).

<tvf> The TableValuedFunction entry that the catalog returned for this TVF

scan. Contains non-concrete function signatures which may include
arguments with templated types.

<signature> The concrete table function signature for this TVF call,

including the types of all scalar arguments and the
number and types of columns of all table-valued
arguments. An engine may also subclass this object to
provide extra custom information and return an instance
of the subclass from the TableValuedFunction::Resolve
method.

<argument_list> The vector of resolved concrete arguments for this TVF

call, including the default values or NULLs injected for
the omitted arguments (Note the NULL injection is a
temporary solution to handle omitted named arguments. This
is subject to change by upcoming CLs).

<column_index_list> This list matches 1-1 with the <column_list>, and identifies the index of the corresponding column in the <signature>'s result relation column list.

<alias> The AS alias for the scan, or empty if none. <function_call_signature> The FunctionSignature object from the

<tvf->signatures()> list that matched the
current call. The TVFScan's
<FunctionSignature::ConcreteArgument> list
matches 1:1 to <argument_list>, while its
<FunctionSignature::arguments> list still has
the full argument list.
The analyzer only sets this field when
it could be ambiguous for an engine to figure
out the actual arguments provided, e.g., when
there are arguments omitted from the call. When
it is provided, engines may use this object to
check for the argument names and omitted
arguments. SQLBuilder may also need this object
in cases when the named argument notation is
required for this call.

func (*TVFScanNode) AddArgument

func (n *TVFScanNode) AddArgument(v *FunctionArgumentNode)

func (*TVFScanNode) AddColumnIndex

func (n *TVFScanNode) AddColumnIndex(v int)

func (*TVFScanNode) Alias

func (n *TVFScanNode) Alias() string

func (*TVFScanNode) ArgumentList

func (n *TVFScanNode) ArgumentList() []*FunctionArgumentNode

func (*TVFScanNode) ColumnIndexList

func (n *TVFScanNode) ColumnIndexList() []int

func (*TVFScanNode) FunctionCallSignature

func (n *TVFScanNode) FunctionCallSignature() *types.FunctionSignature

func (*TVFScanNode) SetAlias

func (n *TVFScanNode) SetAlias(v string)

func (*TVFScanNode) SetArgumentList

func (n *TVFScanNode) SetArgumentList(v []*FunctionArgumentNode)

func (*TVFScanNode) SetColumnIndexList

func (n *TVFScanNode) SetColumnIndexList(v []int)

func (*TVFScanNode) SetFunctionCallSignature

func (n *TVFScanNode) SetFunctionCallSignature(v *types.FunctionSignature)

func (*TVFScanNode) SetSignature

func (n *TVFScanNode) SetSignature(v *types.TVFSignature)

func (*TVFScanNode) SetTVF

func (n *TVFScanNode) SetTVF(v types.TableValuedFunction)

func (*TVFScanNode) Signature

func (n *TVFScanNode) Signature() *types.TVFSignature

func (*TVFScanNode) TVF

type TableAndColumnInfoNode

type TableAndColumnInfoNode struct {
	*BaseArgumentNode
}

TableAndColumnInfoNode identifies the <table> and <column_index_list> (which can be empty) that are targets of the ANALYZE statement.

<column_index_list> This list identifies the ordinals of columns to be analyzed in the <table>'s column list.

func (*TableAndColumnInfoNode) AddColumnIndex

func (n *TableAndColumnInfoNode) AddColumnIndex(v int)

func (*TableAndColumnInfoNode) ColumnIndexList

func (n *TableAndColumnInfoNode) ColumnIndexList() []int

func (*TableAndColumnInfoNode) SetColumnIndexList

func (n *TableAndColumnInfoNode) SetColumnIndexList(v []int)

func (*TableAndColumnInfoNode) SetTable

func (n *TableAndColumnInfoNode) SetTable(v types.Table)

func (*TableAndColumnInfoNode) Table

func (n *TableAndColumnInfoNode) Table() types.Table

type TableScanNode

type TableScanNode struct {
	*BaseScanNode
}

TableScanNode scan a Table. The <column_list>[i] should be matched to a Table column by <table>.GetColumn(<column_index_list>[i]).

If AnalyzerOptions.PruneUnusedColumns is true, the <column_list> and <column_index_list> will include only columns that were referenced in the user query. (SELECT * counts as referencing all columns.) This column_list can then be used for column-level ACL checking on tables. Pruning has no effect on value tables (the value is never pruned).

for_system_time_expr when non NULL resolves to TIMESTAMP used in FOR SYSTEM_TIME AS OF clause. The expression is expected to be constant and no columns are visible to it.

<column_index_list> This list matches 1-1 with the <column_list>, and identifies the ordinal of the corresponding column in the <table>'s column list.

If provided, <alias> refers to an explicit alias which was used to reference a Table in the user query. If the Table was given an implicitly generated alias, then defaults to "".

TODO: Enforce <column_index_list> in the constructor arg list. For historical reasons, some clients match <column_list> to Table columns by ResolvedColumn name. This violates the ResolvedColumn contract, which explicitly states that the ResolvedColumn name has no semantic meaning. All code building a ResolvedTableScan should always set_column_index_list() immediately after construction.

func (*TableScanNode) AddColumnIndex

func (n *TableScanNode) AddColumnIndex(v int)

func (*TableScanNode) Alias

func (n *TableScanNode) Alias() string

func (*TableScanNode) ColumnIndexList

func (n *TableScanNode) ColumnIndexList() []int

func (*TableScanNode) ForSystemTimeExpr

func (n *TableScanNode) ForSystemTimeExpr() ExprNode

func (*TableScanNode) SetAlias

func (n *TableScanNode) SetAlias(v string)

func (*TableScanNode) SetColumnIndexList

func (n *TableScanNode) SetColumnIndexList(v []int)

func (*TableScanNode) SetForSystemTimeExpr

func (n *TableScanNode) SetForSystemTimeExpr(v ExprNode)

func (*TableScanNode) SetTable

func (n *TableScanNode) SetTable(v types.Table)

func (*TableScanNode) Table

func (n *TableScanNode) Table() types.Table

type TruncateStmtNode

type TruncateStmtNode struct {
	*BaseStatementNode
}

TruncateStmtNode represents a TRUNCATE TABLE statement.

Statement:

TRUNCATE TABLE <table_name> [WHERE <boolean_expression>]

<table_scan> is a TableScan for the target table, which is used during

resolving and validation. Consumers can use either the table
object inside it or name_path to reference the table.

<where_expr> boolean expression that can reference columns in

ResolvedColumns (which the TableScan creates); the
<where_expr> should always correspond to entire partitions,
and is optional.

func (*TruncateStmtNode) SetTableScan

func (n *TruncateStmtNode) SetTableScan(v *TableScanNode)

func (*TruncateStmtNode) SetWhereExpr

func (n *TruncateStmtNode) SetWhereExpr(v ExprNode)

func (*TruncateStmtNode) TableScan

func (n *TruncateStmtNode) TableScan() *TableScanNode

func (*TruncateStmtNode) WhereExpr

func (n *TruncateStmtNode) WhereExpr() ExprNode

type UnnestItemNode

type UnnestItemNode struct {
	*BaseArgumentNode
}

UnnestItemNode this is used in CREATE INDEX STMT to represent the unnest operation performed on the base table. The produced element columns or array offset columns (optional) can appear in other UnnestItemNode or index keys.

<array_expr> is the expression of the array field, e.g., t.array_field. <element_column> is the new column produced by this unnest item that

stores the array element value for each row.

<array_offset_column> is optional. If present, it defines the column

produced by this unnest item that stores the array
offset (0-based) for the corresponding
<element_column>.

func (*UnnestItemNode) ArrayExpr

func (n *UnnestItemNode) ArrayExpr() ExprNode

func (*UnnestItemNode) ArrayOffsetColumn

func (n *UnnestItemNode) ArrayOffsetColumn() *ColumnHolderNode

func (*UnnestItemNode) ElementColumn

func (n *UnnestItemNode) ElementColumn() *Column

func (*UnnestItemNode) SetArrayExpr

func (n *UnnestItemNode) SetArrayExpr(v ExprNode)

func (*UnnestItemNode) SetArrayOffsetColumn

func (n *UnnestItemNode) SetArrayOffsetColumn(v *ColumnHolderNode)

func (*UnnestItemNode) SetElementColumn

func (n *UnnestItemNode) SetElementColumn(v *Column)

type UnpivotArgNode

type UnpivotArgNode struct {
	*BaseArgumentNode
}

UnpivotArgNode a column group in the UNPIVOT IN clause.

Example:

'a' in 'UNPIVOT(x FOR z IN (a , b , c))'
or '(a , b)' in 'UNPIVOT((x , y) FOR z IN ((a , b), (c , d))'

func (*UnpivotArgNode) AddColumn

func (n *UnpivotArgNode) AddColumn(v *ColumnRefNode)

func (*UnpivotArgNode) ColumnList

func (n *UnpivotArgNode) ColumnList() []*ColumnRefNode

ColumnList a list of columns referencing an output column of the <input_scan> of UnpivotScanNode. The size of this vector is the same as <value_column_list>.

func (*UnpivotArgNode) SetColumnList

func (n *UnpivotArgNode) SetColumnList(v []*ColumnRefNode)

type UnpivotScanNode

type UnpivotScanNode struct {
	*BaseScanNode
}

UnpivotScanNode a scan produced by the following SQL fragment: <input_scan> UNPIVOT(<value_column_list>

FOR <label_column>
IN (<unpivot_arg_list>))

size of (<unpivot_arg_list>[i], i.e. column groups inside <unpivot_arg_list>)

= size of (<value_column_list>)
= Let's say num_value_columns

size of (<unpivot_arg_list>)

= size of (<label_list>)
= Let's say num_args

Here is how output rows are generated -- for each input row :

for arg_index = 0 .. (num_args - 1) :
  output a row with the original columns from <input_scan>

    plus
  arg = <unpivot_arg_list>[arg_index]
  for value_column_index = 0 .. (num_value_columns - 1) :
    output_value_column = <value_column_list>[value_column_index]
    input_arg_column = arg [value_column_index]
    output_value_column = input_arg_column

    plus
  <label_column> = <label_list>[arg_index]

Hence the total number of rows generated in the output =

input rows * size of <unpivot_arg_list>

For all column groups inside <unpivot_arg_list>, datatype of columns at the same position in the vector must be equivalent, and also equivalent to the datatype of the column at the same position in <value_column_list>. I.e. in the above pseudocode, datatypes must be equivalent for output_value_column and input_arg_column. Datatype of <label_column> must be the same as datatype of <label_list> and can be string or int64.

func (*UnpivotScanNode) AddLabel

func (n *UnpivotScanNode) AddLabel(v *LiteralNode)

func (*UnpivotScanNode) AddProjectedInputColumn

func (n *UnpivotScanNode) AddProjectedInputColumn(v *ComputedColumnNode)

func (*UnpivotScanNode) AddUnpivotArg

func (n *UnpivotScanNode) AddUnpivotArg(v *UnpivotArgNode)

func (*UnpivotScanNode) AddValueColumn

func (n *UnpivotScanNode) AddValueColumn(v *Column)

func (*UnpivotScanNode) IncludeNulls

func (n *UnpivotScanNode) IncludeNulls() bool

IncludeNulls whether we need to include the rows from output where ALL columns from <value_column_list> are null.

func (*UnpivotScanNode) InputScan

func (n *UnpivotScanNode) InputScan() ScanNode

func (*UnpivotScanNode) LabelColumn

func (n *UnpivotScanNode) LabelColumn() *Column

LabelColumn this is a new column added in the output for storing labels for input columns groups that are present in the IN clause. Its values are taken from <label_list>.

func (*UnpivotScanNode) LabelList

func (n *UnpivotScanNode) LabelList() []*LiteralNode

LabelList string or integer literal for each column group in <unpivot_arg_list>.

func (*UnpivotScanNode) ProjectedInputColumnList

func (n *UnpivotScanNode) ProjectedInputColumnList() []*ComputedColumnNode

ProjectedInputColumnList the columns from <input_scan> that are not unpivoted in UNPIVOT IN clause. Columns in <projected_input_column_list> and <unpivot_arg_list> are mutually exclusive and their union is the complete set of columns in the unpivot input-source.

The expression of each ComputedColumnNode is a ColumnRefNode that references a column from <input_scan>.

func (*UnpivotScanNode) SetIncludeNulls

func (n *UnpivotScanNode) SetIncludeNulls(v bool)

func (*UnpivotScanNode) SetInputScan

func (n *UnpivotScanNode) SetInputScan(v ScanNode)

func (*UnpivotScanNode) SetLabelColumn

func (n *UnpivotScanNode) SetLabelColumn(v *Column)

func (*UnpivotScanNode) SetLabelList

func (n *UnpivotScanNode) SetLabelList(v []*LiteralNode)

func (*UnpivotScanNode) SetProjectedInputColumnList

func (n *UnpivotScanNode) SetProjectedInputColumnList(v []*ComputedColumnNode)

func (*UnpivotScanNode) SetUnpivotArgList

func (n *UnpivotScanNode) SetUnpivotArgList(v []*UnpivotArgNode)

func (*UnpivotScanNode) SetValueColumnList

func (n *UnpivotScanNode) SetValueColumnList(v []*Column)

func (*UnpivotScanNode) UnpivotArgList

func (n *UnpivotScanNode) UnpivotArgList() []*UnpivotArgNode

UnpivotArgList the list of groups of columns in the UNPIVOT IN list. Each group contains references to the output columns of <input_scan> of the UnpivotScanNode. The values of these columns are stored in the new <value_column_list> and the column group labels/names in the <label_column>.

func (*UnpivotScanNode) ValueColumnList

func (n *UnpivotScanNode) ValueColumnList() []*Column

ValueColumnList list of one or more new columns added by UNPIVOT. These new column(s) store the value of input columns that are in the UNPIVOT IN clause.

type UpdateArrayItemNode

type UpdateArrayItemNode struct {
	*BaseArgumentNode
}

UpdateArrayItemNode for an array element modification, this node represents the offset expression and the modification, but not the array. E.g., for SET a[<expr>] = 5, this node represents a modification of "= 5" to offset <expr> of the array defined by the parent node.

func (*UpdateArrayItemNode) Offset

func (n *UpdateArrayItemNode) Offset() ExprNode

Offset the array offset to be modified.

func (*UpdateArrayItemNode) SetOffset

func (n *UpdateArrayItemNode) SetOffset(v ExprNode)

func (*UpdateArrayItemNode) SetUpdateItem

func (n *UpdateArrayItemNode) SetUpdateItem(v *UpdateItemNode)

func (*UpdateArrayItemNode) UpdateItem

func (n *UpdateArrayItemNode) UpdateItem() *UpdateItemNode

UpdateItem the modification to perform to the array element.

type UpdateItemNode

type UpdateItemNode struct {
	*BaseArgumentNode
}

UpdateItemNode represents one item inside the SET clause of an UPDATE.

The entity being updated is specified by <target>.

For a regular

SET {target} = {expression} | DEFAULT

clause (not including an array element update like SET a[OFFSET(0)] = 5), <target> and <set_value> will be present, and all other fields will be unset.

For an array element update (e.g. SET a.b[<expr>].c = <value>),

  • <target> is set to the array,
  • <element_column> is a new Column that can be used inside the update items to refer to the array element.
  • <array_update_list> will have a node corresponding to the offset into that array and the modification to that array element.

For example, for SET a.b[<expr>].c = <value>, we have

UpdateItemNode
+-<target> = a.b
+-<element_column> = <x>
+-<array_update_list>
  +-UpdateArrayItemNode
    +-<offset> = <expr>
    +-<update_item> = UpdateItemNode
      +-<target> = <x>.c
      +-<set_value> = <value>

The engine is required to fail the update if there are two elements of <array_update_list> corresponding to offset expressions that evaluate to the same value. These are considered to be conflicting updates.

Multiple updates to the same array are always represented as multiple elements of <array_update_list> under a single UpdateItemNode corresponding to that array. <array_update_list> will only have one element for modifications to an array-valued subfield of an array element. E.g., for SET a[<expr1>].b[<expr2>] = 5, a[<expr3>].b[<expr4>] = 6, we will have:

UpdateItemNode
+-<target> = a
+-<element_column> = x
+-<array_update_list>
  +-UpdateArrayItemNode
    +-<offset> = <expr1>
    +-UpdateItemNode for <x>.b[<expr2>] = 5
  +-UpdateArrayItemNode
    +-<offset> = <expr3>
    +-UpdateItemNode for <x>.b[<expr4>] = 6

The engine must give a runtime error if <expr1> and <expr3> evaluate to the same thing. Notably, it does not have to understand that the two UpdateItemNodes corresponding to "b" refer to the same array iff <expr1> and <expr3> evaluate to the same thing.

TODO: Consider allowing the engine to execute an update like SET a[<expr1>].b = 1, a[<expr2>].c = 2 even if <expr1> == <expr2> since "b" and "c" do not overlap. Also consider allowing a more complex example like SET a[<expr1>].b[<expr2>] = ..., a[<expr3>].b[<expr4>].c[<expr5>] = ... even if <expr1> == <expr3>, as long as <expr2> != <expr4> in that case.

For nested DML, <target> and <element_column> will both be set, and one or more of the nested statement lists will be non-empty. <target> must have ARRAY type, and <element_column> introduces a Column representing elements of that array. The nested statement lists will always be empty in a UpdateItemNode child of a UpdateArrayItemNode.

func (*UpdateItemNode) AddArrayUpdate

func (n *UpdateItemNode) AddArrayUpdate(v *UpdateArrayItemNode)

func (*UpdateItemNode) AddDelete

func (n *UpdateItemNode) AddDelete(v *DeleteStmtNode)

func (*UpdateItemNode) AddInsert

func (n *UpdateItemNode) AddInsert(v *InsertStmtNode)

func (*UpdateItemNode) AddUpdate

func (n *UpdateItemNode) AddUpdate(v *UpdateStmtNode)

func (*UpdateItemNode) ArrayUpdateList

func (n *UpdateItemNode) ArrayUpdateList() []*UpdateArrayItemNode

ArrayUpdateList array element modifications to apply. Each item runs on the value of <element_column> specified by UpdateArrayItemNode.offset. This field is always empty if the analyzer option FEATURE_V_1_2_ARRAY_ELEMENTS_WITH_SET is disabled.

The engine must fail if two elements in this list have offset expressions that evaluate to the same value. TODO: Consider generalizing this to allow SET a[<expr1>].b = ..., a[<expr2>].c = ...

func (*UpdateItemNode) DeleteList

func (n *UpdateItemNode) DeleteList() []*DeleteStmtNode

DeleteList nested DELETE statements to apply. Each delete runs on one value of <element_column> and may choose to delete that array element.

DELETEs are applied before INSERTs or UPDATEs.

It is legal for the same input element to match multiple DELETEs.

func (*UpdateItemNode) ElementColumn

func (n *UpdateItemNode) ElementColumn() *ColumnHolderNode

ElementColumn the Column introduced to represent the elements of the array being updated. This works similarly to ArrayScan.ElementColumn().

<target> must have array type, and this column has the array's element type.

This column can be referenced inside the nested statements below.

func (*UpdateItemNode) InsertList

func (n *UpdateItemNode) InsertList() []*InsertStmtNode

InsertList nested INSERT statements to apply. Each insert will produce zero or more values for <element_column>.

INSERTs are applied after DELETEs and UPDATEs.

For nested UPDATEs, insert_mode will always be the default, and has no effect.

func (*UpdateItemNode) SetArrayUpdateList

func (n *UpdateItemNode) SetArrayUpdateList(v []*UpdateArrayItemNode)

func (*UpdateItemNode) SetDeleteList

func (n *UpdateItemNode) SetDeleteList(v []*DeleteStmtNode)

func (*UpdateItemNode) SetElementColumn

func (n *UpdateItemNode) SetElementColumn(v *ColumnHolderNode)

func (*UpdateItemNode) SetInsertList

func (n *UpdateItemNode) SetInsertList(v []*InsertStmtNode)

func (*UpdateItemNode) SetSetValue

func (n *UpdateItemNode) SetSetValue(v *DMLValueNode)

func (*UpdateItemNode) SetTarget

func (n *UpdateItemNode) SetTarget(v ExprNode)

func (*UpdateItemNode) SetUpdateList

func (n *UpdateItemNode) SetUpdateList(v []*UpdateStmtNode)

func (*UpdateItemNode) SetValue

func (n *UpdateItemNode) SetValue() *DMLValueNode

SetValue set the target entity to this value. The types must match. This can contain the same columns that can appear in the <where_expr> of the enclosing UpdateStmtNode.

This is mutually exclusive with all fields below, which are used for nested updates only.

func (*UpdateItemNode) Target

func (n *UpdateItemNode) Target() ExprNode

Target the target entity to be updated.

This is an expression evaluated using the Columns visible inside this statement. This expression can contain only ColumnRefNodes, GetProtoFieldNode and GetStructFieldNodes.

In a top-level UPDATE, the expression always starts with a ColumnRefNode referencing a column from the statement's TableScan.

In a nested UPDATE, the expression always starts with a ColumnRefNode referencing the element_column from the UpdateItemNode containing this scan.

This node is also used to represent a modification of a single array element (when it occurs as a child of a UpdateArrayItemNode). In that case, the expression starts with a ColumnRefNode referencing the <element_column> from its grandparent UpdateItemNode. (E.g., for "SET a[<expr>] = 5", the grandparent UpdateItemNode has <target> "a", the parent UpdateArrayItemNode has offset <expr>, and this node has <set_value> 5 and target corresponding to the grandparent's <element_column> field.)

For either a nested UPDATE or an array modification, there may be a path of field accesses after the initial ColumnRefNode, represented by a chain of GetField nodes.

NOTE: We use the same GetField nodes as we do for queries, but they are not treated the same. Here, they express a path inside an object that is being mutated, so they have reference semantics.

func (*UpdateItemNode) UpdateList

func (n *UpdateItemNode) UpdateList() []*UpdateStmtNode

UpdateList nested UPDATE statements to apply. Each update runs on one value of <element_column> and may choose to update that array element.

UPDATEs are applied after DELETEs and before INSERTs.

It is an error if any element is matched by multiple UPDATEs.

type UpdateStmtNode

type UpdateStmtNode struct {
	*BaseStatementNode
}

UpdateStmtNode represents an UPDATE statement, or a nested UPDATE inside an UPDATE statement.

For top-level UPDATE statements, <table_scan> gives the table to scan and creates Columns for its columns. Those columns can be referenced in the <update_item_list>. The top-level UPDATE statement may also have <from_scan>, the output of which is joined with the <table_scan> using expressions in the <where_expr>. The columns exposed in the <from_scan> are visible in the right side of the expressions in the <update_item_list> and in the <where_expr>. <array_offset_column> is never set for top-level UPDATE statements.

Top-level UPDATE statements will also have <column_access_list> populated. For each column, this vector indicates if the column was read and/or written. The columns in this vector match those of <table_scan.column_list>. If a column was not encountered when producing the resolved AST, then the value at that index will be Statement::NONE.

For nested UPDATEs, there is no <table_scan>. The <where_expr> can only reference:

(1) the element_column from the UpdateItemNode containing this statement,
(2) columns from the outer statements, and
(3) (optionally) <array_offset_column>, which represents the 0-based
    offset of the array element being modified.

The left hand sides of the expressions in <update_item_list> can only reference (1). The right hand sides of those expressions can reference (1), (2), and (3).

The updates in <update_item_list> will be non-overlapping. If there are multiple nested statements updating the same entity, they will be combined into one UpdateItemNode.

If <returning> is present, the UPDATE statement will return updated rows. <returning> can only occur on top-level statements.

This returning clause has a <output_column_list> to represent the data sent back to clients. It can only access columns from the <table_scan>. The columns in <from_scan> are not allowed. TODO: allow columns in <from_scan> to be referenced.

func (*UpdateStmtNode) AddColumnAccess

func (n *UpdateStmtNode) AddColumnAccess(v ObjectAccess)

func (*UpdateStmtNode) AddUpdateItemList

func (n *UpdateStmtNode) AddUpdateItemList(v *UpdateItemNode)

func (*UpdateStmtNode) ArrayOffsetColumn

func (n *UpdateStmtNode) ArrayOffsetColumn() *ColumnHolderNode

func (*UpdateStmtNode) AssertRowsModified

func (n *UpdateStmtNode) AssertRowsModified() *AssertRowsModifiedNode

func (*UpdateStmtNode) ColumnAccessList

func (n *UpdateStmtNode) ColumnAccessList() []ObjectAccess

func (*UpdateStmtNode) FromScan

func (n *UpdateStmtNode) FromScan() ScanNode

func (*UpdateStmtNode) Returning

func (n *UpdateStmtNode) Returning() *ReturningClauseNode

func (*UpdateStmtNode) SetArrayOffsetColumn

func (n *UpdateStmtNode) SetArrayOffsetColumn(v *ColumnHolderNode)

func (*UpdateStmtNode) SetAssertRowsModified

func (n *UpdateStmtNode) SetAssertRowsModified(v *AssertRowsModifiedNode)

func (*UpdateStmtNode) SetColumnAccessList

func (n *UpdateStmtNode) SetColumnAccessList(v []ObjectAccess)

func (*UpdateStmtNode) SetFromScan

func (n *UpdateStmtNode) SetFromScan(v ScanNode)

func (*UpdateStmtNode) SetReturning

func (n *UpdateStmtNode) SetReturning(v *ReturningClauseNode)

func (*UpdateStmtNode) SetTableScan

func (n *UpdateStmtNode) SetTableScan(v *TableScanNode)

func (*UpdateStmtNode) SetUpdateItemList

func (n *UpdateStmtNode) SetUpdateItemList(v []*UpdateItemNode)

func (*UpdateStmtNode) SetWhereExpr

func (n *UpdateStmtNode) SetWhereExpr(v ExprNode)

func (*UpdateStmtNode) TableScan

func (n *UpdateStmtNode) TableScan() *TableScanNode

func (*UpdateStmtNode) UpdateItemList

func (n *UpdateStmtNode) UpdateItemList() []*UpdateItemNode

func (*UpdateStmtNode) WhereExpr

func (n *UpdateStmtNode) WhereExpr() ExprNode

type WindowFrameExprNode

type WindowFrameExprNode struct {
	*BaseArgumentNode
}

WindowFrameExprNode window frame boundary expression that determines the first/last row of the moving window for each tuple.

<expression> cannot be NULL if the type is OFFSET_PRECEDING or OFFSET_FOLLOWING. It must be a constant expression. If this is a boundary for a ROW-based window, it must be integer type. Otherwise, it must be numeric type and must match exactly the type of the window ordering expression.

func (*WindowFrameExprNode) BoundaryType

func (n *WindowFrameExprNode) BoundaryType() BoundaryType

func (*WindowFrameExprNode) Expression

func (n *WindowFrameExprNode) Expression() ExprNode

func (*WindowFrameExprNode) SetBoundaryType

func (n *WindowFrameExprNode) SetBoundaryType(v BoundaryType)

func (*WindowFrameExprNode) SetExpression

func (n *WindowFrameExprNode) SetExpression(v ExprNode)

type WindowFrameNode

type WindowFrameNode struct {
	*BaseArgumentNode
}

WindowFrameNode window framing specification for an analytic function call.

ROW-based window frames compute the frame based on physical offsets from the current row. RANGE-based window frames compute the frame based on a logical range of rows around the current row based on the current row's ORDER BY key value.

<start_expr> and <end_expr> cannot be NULL. If the window frame is one-sided in the input query, the resolver will generate an implicit ending boundary.

func (*WindowFrameNode) EndExpr

func (n *WindowFrameNode) EndExpr() *WindowFrameExprNode

func (*WindowFrameNode) FrameUnit

func (n *WindowFrameNode) FrameUnit() FrameUnit

func (*WindowFrameNode) SetEndExpr

func (n *WindowFrameNode) SetEndExpr(v *WindowFrameExprNode)

func (*WindowFrameNode) SetFrameUnit

func (n *WindowFrameNode) SetFrameUnit(v FrameUnit)

func (*WindowFrameNode) SetStartExpr

func (n *WindowFrameNode) SetStartExpr(v *WindowFrameExprNode)

func (*WindowFrameNode) StartExpr

func (n *WindowFrameNode) StartExpr() *WindowFrameExprNode

type WindowOrderingNode

type WindowOrderingNode struct {
	*BaseArgumentNode
}

WindowOrderingNode window ordering specification for an analytic function call.

ORDER BY items in <order_by_list>. There should be exactly one ORDER BY item if this is a window ORDER BY for a RANGE-based window.

func (*WindowOrderingNode) AddHint

func (n *WindowOrderingNode) AddHint(v *OptionNode)

func (*WindowOrderingNode) AddOrderByItem

func (n *WindowOrderingNode) AddOrderByItem(v *OrderByItemNode)

func (*WindowOrderingNode) HintList

func (n *WindowOrderingNode) HintList() []*OptionNode

func (*WindowOrderingNode) OrderByItemList

func (n *WindowOrderingNode) OrderByItemList() []*OrderByItemNode

func (*WindowOrderingNode) SetHintList

func (n *WindowOrderingNode) SetHintList(v []*OptionNode)

func (*WindowOrderingNode) SetOrderByItemList

func (n *WindowOrderingNode) SetOrderByItemList(v []*OrderByItemNode)

type WindowPartitioningNode

type WindowPartitioningNode struct {
	*BaseArgumentNode
}

WindowPartitioningNode window partitioning specification for an analytic function call.

PARTITION BY keys in <partition_by_list>.

func (*WindowPartitioningNode) AddHint

func (n *WindowPartitioningNode) AddHint(v *OptionNode)

func (*WindowPartitioningNode) AddPartitionBy

func (n *WindowPartitioningNode) AddPartitionBy(v *ColumnRefNode)

func (*WindowPartitioningNode) HintList

func (n *WindowPartitioningNode) HintList() []*OptionNode

func (*WindowPartitioningNode) PartitionByList

func (n *WindowPartitioningNode) PartitionByList() []*ColumnRefNode

func (*WindowPartitioningNode) SetHintList

func (n *WindowPartitioningNode) SetHintList(v []*OptionNode)

func (*WindowPartitioningNode) SetPartitionByList

func (n *WindowPartitioningNode) SetPartitionByList(v []*ColumnRefNode)

type WithEntryNode

type WithEntryNode struct {
	*BaseArgumentNode
}

WithEntryNode represents one aliased subquery introduced in a WITH clause.

The <with_query_name>s must be globally unique in the full resolved AST. The <with_subquery> cannot be correlated and cannot reference any columns from outside. It may reference other WITH subqueries.

See WithScanNode for full details.

func (*WithEntryNode) SetWithQueryName

func (n *WithEntryNode) SetWithQueryName(v string)

func (*WithEntryNode) SetWithSubquery

func (n *WithEntryNode) SetWithSubquery(v ScanNode)

func (*WithEntryNode) WithQueryName

func (n *WithEntryNode) WithQueryName() string

func (*WithEntryNode) WithSubquery

func (n *WithEntryNode) WithSubquery() ScanNode

type WithPartitionColumnsNode

type WithPartitionColumnsNode struct {
	*BaseArgumentNode
}

WithPartitionColumnsNode this statement: WITH PARTITION COLUMNS [(column schema, ...)]

func (*WithPartitionColumnsNode) AddColumnDefinition

func (n *WithPartitionColumnsNode) AddColumnDefinition(v *ColumnDefinitionNode)

func (*WithPartitionColumnsNode) ColumnDefinitionList

func (n *WithPartitionColumnsNode) ColumnDefinitionList() []*ColumnDefinitionNode

func (*WithPartitionColumnsNode) SetColumnDefinitionList

func (n *WithPartitionColumnsNode) SetColumnDefinitionList(v []*ColumnDefinitionNode)

type WithRefScanNode

type WithRefScanNode struct {
	*BaseScanNode
}

WithRefScanNode scan the subquery defined in a WITH statement. See WithScanNode for more detail. The column_list produced here will match 1:1 with the column_list produced by the referenced subquery and will given a new unique name to each column produced for this scan.

func (*WithRefScanNode) SetWithQueryName

func (n *WithRefScanNode) SetWithQueryName(v string)

func (*WithRefScanNode) WithQueryName

func (n *WithRefScanNode) WithQueryName() string

type WithScanNode

type WithScanNode struct {
	*BaseScanNode
}

WithScanNode this represents a SQL WITH query (or subquery) like

WITH [RECURSIVE] <with_query_name1> AS (<with_subquery1>),
     <with_query_name2> AS (<with_subquery2>)
<query>;

WITH entries are sorted in dependency order so that an entry can only reference entries earlier in <with_entry_list>, plus itself if the RECURSIVE keyword is used. If the RECURSIVE keyword is not used, this will be the same order as in the original query, since an entry which references itself or any entry later in the list is not allowed.

If a WITH subquery is referenced multiple times, the full query should behave as if the subquery runs only once and its result is reused.

There will be one WithEntryNode here for each subquery in the SQL WITH statement, in the same order as in the query.

Inside the resolved <query>, or any <with_entry_list> occurring after its definition, a <with_query_name> used as a table scan will be represented using a WithRefScanNode.

The <with_query_name> aliases are always unique within a query, and should be used to connect the WithRefScanNode to the original query definition. The subqueries are not inlined and duplicated into the tree.

In ZetaSQL 1.0, WITH is allowed only on the outermost query and not in subqueries, so the WithScanNode node can only occur as the outermost scan in a statement (e.g. a QueryStmt or CreateTableAsSelectStmt).

In ZetaSQL 1.1 (language option FEATURE_V_1_1_WITH_ON_SUBQUERY), WITH is allowed on subqueries. Then, WithScanNode can occur anywhere in the tree. The alias introduced by a WithEntryNode is visible only in subsequent WithEntryNode queries and in <query>. The aliases used must be globally unique in the resolved AST however, so consumers do not need to implement any scoping for these names. Because the aliases are unique, it is legal to collect all WithEntriesNode in the tree and treat them as if they were a single WITH clause at the outermost level.

In ZetaSQL 1.3 (language option FEATURE_V_1_3_WITH_RECURSIVE), WITH RECURSIVE is supported, which allows any <with_subquery> to reference any <with_query_name>, regardless of order, including WITH entries which reference themself. Circular dependency chains of WITH entries are allowed only for direct self-references, and only when the corresponding <with_subquery> takes the form "<non-recursive-term> UNION [ALL|DISTINCT] <recursive-term>", with all references to the current <with_query_name> confined to the recursive term.

The subqueries inside WithEntriesNode cannot be correlated.

If a WITH subquery is defined but never referenced, it will still be resolved and still show up here. Query engines may choose not to run it.

func (*WithScanNode) AddWithEntry

func (n *WithScanNode) AddWithEntry(v *WithEntryNode)

func (*WithScanNode) Query

func (n *WithScanNode) Query() ScanNode

func (*WithScanNode) Recursive

func (n *WithScanNode) Recursive() bool

Recursive true if the WITH clause uses the recursive keyword.

func (*WithScanNode) SetQuery

func (n *WithScanNode) SetQuery(v ScanNode)

func (*WithScanNode) SetRecursive

func (n *WithScanNode) SetRecursive(v bool)

func (*WithScanNode) SetWithEntryList

func (n *WithScanNode) SetWithEntryList(v []*WithEntryNode)

func (*WithScanNode) WithEntryList

func (n *WithScanNode) WithEntryList() []*WithEntryNode

Jump to

Keyboard shortcuts

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