types

package
v0.5.1-nutshell-1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UNKNOWN     TypeKind = 0
	INT32                = 1
	INT64                = 2
	UINT32               = 3
	UINT64               = 4
	BOOL                 = 5
	FLOAT                = 6
	DOUBLE               = 7
	STRING               = 8
	BYTES                = 9
	DATE                 = 10
	TIMESTAMP            = 19
	ENUM                 = 15
	ARRAY                = 16
	STRUCT               = 17
	PROTO                = 18
	TIME                 = 20
	DATETIME             = 21
	GEOGRAPHY            = 22
	NUMERIC              = 23
	BIG_NUMERIC          = 24
	EXTENDED             = 25
	JSON                 = 26
	INTERVAL             = 27
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AnnotatedType

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

AnnotatedType holds unowned pointers to Type and AnnoationMap. <annotation_map> could be nil to indicate that the <type> doesn't have annotation.

func (*AnnotatedType) AnnotationMap

func (t *AnnotatedType) AnnotationMap() AnnotationMap

func (*AnnotatedType) Type

func (t *AnnotatedType) Type() Type

type AnnotationMap

type AnnotationMap interface {
	IsStructMap() bool
	IsArrayMap() bool
	// contains filtered or unexported methods
}

AnnotationMap maps from AnnotationSpec ID to SimpleValue.

type AnonymizationInfo

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

type ArgumentCardinality

type ArgumentCardinality int
const (
	RequiredArgumentCardinality ArgumentCardinality = 0
	RepeatedArgumentCardinality ArgumentCardinality = 1
	OptionalArgumentCardinality ArgumentCardinality = 2
)

type ArgumentCollationMode

type ArgumentCollationMode int
const (
	AffectsNone                    ArgumentCollationMode = 0
	AffectsOperation               ArgumentCollationMode = 1
	AffectsPropagation             ArgumentCollationMode = 2
	AffectsOperationAndPropagation ArgumentCollationMode = 3
)

type ArgumentTypeLambda

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

ArgumentTypeLambda contains type information for ARG_TYPE_LAMBDA, which represents the lambda type of a function argument. A lambda has a list of arguments and a body. Both the lambda arguments and body could be templated or nontemplated. Putting them together to minimize stack usage of FunctionArgumentType.

func (*ArgumentTypeLambda) ArgumentTypes

func (t *ArgumentTypeLambda) ArgumentTypes() []*FunctionArgumentType

func (*ArgumentTypeLambda) BodyType

type ArrayAnnotationMap

type ArrayAnnotationMap struct {
	*BaseAnnotationMap
}

type ArrayType

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

func ArrayTypeFromKind

func ArrayTypeFromKind(kind TypeKind) *ArrayType

func BigNumericArrayType

func BigNumericArrayType() *ArrayType

func BoolArrayType

func BoolArrayType() *ArrayType

func BytesArrayType

func BytesArrayType() *ArrayType

func DateArrayType

func DateArrayType() *ArrayType

func DatetimeArrayType

func DatetimeArrayType() *ArrayType

func DoubleArrayType

func DoubleArrayType() *ArrayType

func FloatArrayType

func FloatArrayType() *ArrayType

func GeographyArrayType

func GeographyArrayType() *ArrayType

func Int32ArrayType

func Int32ArrayType() *ArrayType

func Int64ArrayType

func Int64ArrayType() *ArrayType

func IntervalArrayType

func IntervalArrayType() *ArrayType

func JsonArrayType

func JsonArrayType() *ArrayType

func NewArrayType

func NewArrayType(elem Type) (*ArrayType, error)

func NumericArrayType

func NumericArrayType() *ArrayType

func StringArrayType

func StringArrayType() *ArrayType

func TimeArrayType

func TimeArrayType() *ArrayType

func TimestampArrayType

func TimestampArrayType() *ArrayType

func Uint32ArrayType

func Uint32ArrayType() *ArrayType

func Uint64ArrayType

func Uint64ArrayType() *ArrayType

func (ArrayType) AsArray

func (t ArrayType) AsArray() *ArrayType

func (ArrayType) AsEnum

func (t ArrayType) AsEnum() *EnumType

func (ArrayType) AsStruct

func (t ArrayType) AsStruct() *StructType

func (ArrayType) DebugString

func (t ArrayType) DebugString(details bool) string

func (*ArrayType) ElementType

func (t *ArrayType) ElementType() Type

func (ArrayType) Equals

func (t ArrayType) Equals(typ Type) bool

func (ArrayType) Equivalent

func (t ArrayType) Equivalent(typ Type) bool

func (ArrayType) HasAnyFields

func (t ArrayType) HasAnyFields() bool

func (ArrayType) IsArray

func (t ArrayType) IsArray() bool

func (ArrayType) IsBigNumericType

func (t ArrayType) IsBigNumericType() bool

func (ArrayType) IsBool

func (t ArrayType) IsBool() bool

func (ArrayType) IsBytes

func (t ArrayType) IsBytes() bool

func (ArrayType) IsCivilDateOrTimeType

func (t ArrayType) IsCivilDateOrTimeType() bool

func (ArrayType) IsDate

func (t ArrayType) IsDate() bool

func (ArrayType) IsDatetime

func (t ArrayType) IsDatetime() bool

func (ArrayType) IsDouble

func (t ArrayType) IsDouble() bool

func (ArrayType) IsEnum

func (t ArrayType) IsEnum() bool

func (ArrayType) IsExtendedType

func (t ArrayType) IsExtendedType() bool

func (ArrayType) IsFeatureV12CivilTimeType

func (t ArrayType) IsFeatureV12CivilTimeType() bool

func (ArrayType) IsFloat

func (t ArrayType) IsFloat() bool

func (ArrayType) IsFloatingPoint

func (t ArrayType) IsFloatingPoint() bool

func (ArrayType) IsGeography

func (t ArrayType) IsGeography() bool

func (ArrayType) IsInt32

func (t ArrayType) IsInt32() bool

func (ArrayType) IsInt64

func (t ArrayType) IsInt64() bool

func (ArrayType) IsInteger

func (t ArrayType) IsInteger() bool

func (ArrayType) IsInteger32

func (t ArrayType) IsInteger32() bool

func (ArrayType) IsInteger64

func (t ArrayType) IsInteger64() bool

func (ArrayType) IsInterval

func (t ArrayType) IsInterval() bool

func (ArrayType) IsJson

func (t ArrayType) IsJson() bool

func (ArrayType) IsJsonType

func (t ArrayType) IsJsonType() bool

func (ArrayType) IsNumericType

func (t ArrayType) IsNumericType() bool

func (ArrayType) IsNumerical

func (t ArrayType) IsNumerical() bool

func (ArrayType) IsProto

func (t ArrayType) IsProto() bool

func (ArrayType) IsSignedInteger

func (t ArrayType) IsSignedInteger() bool

func (ArrayType) IsSimpleType

func (t ArrayType) IsSimpleType() bool

func (ArrayType) IsString

func (t ArrayType) IsString() bool

func (ArrayType) IsStruct

func (t ArrayType) IsStruct() bool

func (ArrayType) IsStructOrProto

func (t ArrayType) IsStructOrProto() bool

func (ArrayType) IsTime

func (t ArrayType) IsTime() bool

func (ArrayType) IsTimestamp

func (t ArrayType) IsTimestamp() bool

func (ArrayType) IsUint32

func (t ArrayType) IsUint32() bool

func (ArrayType) IsUint64

func (t ArrayType) IsUint64() bool

func (ArrayType) IsUnsignedInteger

func (t ArrayType) IsUnsignedInteger() bool

func (ArrayType) Kind

func (t ArrayType) Kind() TypeKind

func (ArrayType) NestingDepth

func (t ArrayType) NestingDepth() int

func (ArrayType) ShortTypeName

func (t ArrayType) ShortTypeName(mode ProductMode) string

func (ArrayType) SupportsEquality

func (t ArrayType) SupportsEquality() bool

func (ArrayType) SupportsGrouping

func (t ArrayType) SupportsGrouping() bool

func (ArrayType) SupportsOrdering

func (t ArrayType) SupportsOrdering() bool

func (ArrayType) SupportsPartitioning

func (t ArrayType) SupportsPartitioning() bool

func (ArrayType) TypeName

func (t ArrayType) TypeName(mode ProductMode) string

func (ArrayType) TypeNameWithParameters

func (t ArrayType) TypeNameWithParameters(param *TypeParameters, mode ProductMode) (string, error)

func (ArrayType) UsingFeatureV12CivilTimeType

func (t ArrayType) UsingFeatureV12CivilTimeType() bool

func (ArrayType) ValidateAndResolveTypeParameters

func (t ArrayType) ValidateAndResolveTypeParameters(values []TypeParameterValue, mode ProductMode) (*TypeParameters, error)

func (ArrayType) ValidateResolvedTypeParameters

func (t ArrayType) ValidateResolvedTypeParameters(params *TypeParameters, mode ProductMode) error

type BaseAnnotationMap

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

func (*BaseAnnotationMap) IsArrayMap

func (m *BaseAnnotationMap) IsArrayMap() bool

func (*BaseAnnotationMap) IsStructMap

func (m *BaseAnnotationMap) IsStructMap() bool

type BaseCatalog

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

func (*BaseCatalog) ExtendedTypeSuperTypes

func (c *BaseCatalog) ExtendedTypeSuperTypes(typ Type) (*TypeListView, error)

func (*BaseCatalog) FindConnection

func (c *BaseCatalog) FindConnection(path []string) (Connection, error)

func (*BaseCatalog) FindConstant

func (c *BaseCatalog) FindConstant(path []string) (Constant, int, error)

func (*BaseCatalog) FindConversion

func (c *BaseCatalog) FindConversion(from, to Type) (Conversion, error)

func (*BaseCatalog) FindFunction

func (c *BaseCatalog) FindFunction(path []string) (*Function, error)

func (*BaseCatalog) FindModel

func (c *BaseCatalog) FindModel(path []string) (Model, error)

func (*BaseCatalog) FindProcedure

func (c *BaseCatalog) FindProcedure(path []string) (*Procedure, error)

func (*BaseCatalog) FindTable

func (c *BaseCatalog) FindTable(path []string) (Table, error)

func (*BaseCatalog) FindTableValuedFunction

func (c *BaseCatalog) FindTableValuedFunction(path []string) (TableValuedFunction, error)

func (*BaseCatalog) FindType

func (c *BaseCatalog) FindType(path []string) (Type, error)

func (*BaseCatalog) FullName

func (c *BaseCatalog) FullName() string

func (*BaseCatalog) SuggestConstant

func (c *BaseCatalog) SuggestConstant(mistypedPath []string) string

func (*BaseCatalog) SuggestFunction

func (c *BaseCatalog) SuggestFunction(mistypedPath []string) string

func (*BaseCatalog) SuggestModel

func (c *BaseCatalog) SuggestModel(mistypedPath []string) string

func (*BaseCatalog) SuggestTable

func (c *BaseCatalog) SuggestTable(mistypedPath []string) string

func (*BaseCatalog) SuggestTableValuedFunction

func (c *BaseCatalog) SuggestTableValuedFunction(mistypedPath []string) string

type BaseColumn

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

func (*BaseColumn) FullName

func (c *BaseColumn) FullName() string

func (*BaseColumn) IsPseudoColumn

func (c *BaseColumn) IsPseudoColumn() bool

func (*BaseColumn) IsWritableColumn

func (c *BaseColumn) IsWritableColumn() bool

func (*BaseColumn) Name

func (c *BaseColumn) Name() string

func (*BaseColumn) Type

func (c *BaseColumn) Type() Type

func (*BaseColumn) TypeAnnotationMap

func (c *BaseColumn) TypeAnnotationMap() AnnotationMap

type BaseEnumerableCatalog

type BaseEnumerableCatalog struct {
	*BaseCatalog
}

func (*BaseEnumerableCatalog) Catalogs

func (c *BaseEnumerableCatalog) Catalogs() ([]Catalog, error)

func (*BaseEnumerableCatalog) Conversions

func (c *BaseEnumerableCatalog) Conversions() ([]Conversion, error)

func (*BaseEnumerableCatalog) Functions

func (c *BaseEnumerableCatalog) Functions() ([]*Function, error)

func (*BaseEnumerableCatalog) Tables

func (c *BaseEnumerableCatalog) Tables() ([]Table, error)

func (*BaseEnumerableCatalog) Types

func (c *BaseEnumerableCatalog) Types() ([]Type, error)

type BaseModel

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

func (*BaseModel) FindInputByName

func (m *BaseModel) FindInputByName(name string) Column

func (*BaseModel) FindOutputByName

func (m *BaseModel) FindOutputByName(name string) Column

func (*BaseModel) FullName

func (m *BaseModel) FullName() string

func (*BaseModel) Input

func (m *BaseModel) Input(i int) Column

func (*BaseModel) Name

func (m *BaseModel) Name() string

func (*BaseModel) NumInputs

func (m *BaseModel) NumInputs() uint64

func (*BaseModel) NumOutputs

func (m *BaseModel) NumOutputs() uint64

func (*BaseModel) Output

func (m *BaseModel) Output(i int) Column

func (*BaseModel) SerializationID

func (m *BaseModel) SerializationID() int64

type BaseTable

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

func (*BaseTable) AnonymizationInfo

func (t *BaseTable) AnonymizationInfo() *AnonymizationInfo

func (*BaseTable) Column

func (t *BaseTable) Column(idx int) Column

func (*BaseTable) CreateEvaluatorTableIterator

func (t *BaseTable) CreateEvaluatorTableIterator(columnIdxs []int) (*EvaluatorTableIterator, error)

func (*BaseTable) FindColumnByName

func (t *BaseTable) FindColumnByName(name string) Column

func (*BaseTable) FullName

func (t *BaseTable) FullName() string

func (*BaseTable) IsValueTable

func (t *BaseTable) IsValueTable() bool

func (*BaseTable) Name

func (t *BaseTable) Name() string

func (*BaseTable) NumColumns

func (t *BaseTable) NumColumns() int

func (*BaseTable) PrimaryKey

func (t *BaseTable) PrimaryKey() []int

func (*BaseTable) SerializationID

func (t *BaseTable) SerializationID() int64

func (*BaseTable) SupportsAnonymization

func (t *BaseTable) SupportsAnonymization() bool

func (*BaseTable) TableTypeName

func (t *BaseTable) TableTypeName(mode ProductMode) string

type BaseTableValuedFunction

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

func (*BaseTableValuedFunction) AddSignature

func (f *BaseTableValuedFunction) AddSignature(sig *FunctionSignature) error

func (*BaseTableValuedFunction) AnonymizationInfo

func (f *BaseTableValuedFunction) AnonymizationInfo() *AnonymizationInfo

func (*BaseTableValuedFunction) DebugString

func (f *BaseTableValuedFunction) DebugString() string

func (*BaseTableValuedFunction) FullName

func (f *BaseTableValuedFunction) FullName() string

func (*BaseTableValuedFunction) FunctionNamePath

func (f *BaseTableValuedFunction) FunctionNamePath() []string

func (*BaseTableValuedFunction) Name

func (f *BaseTableValuedFunction) Name() string

func (*BaseTableValuedFunction) NumSignatures

func (f *BaseTableValuedFunction) NumSignatures() int64

func (*BaseTableValuedFunction) SetUserIdColumnNamePath

func (f *BaseTableValuedFunction) SetUserIdColumnNamePath(path []string) error

func (*BaseTableValuedFunction) Signature

func (f *BaseTableValuedFunction) Signature(idx int64) *FunctionSignature

func (*BaseTableValuedFunction) Signatures

func (f *BaseTableValuedFunction) Signatures() []*FunctionSignature

func (*BaseTableValuedFunction) SupportedSignaturesUserFacingText

func (f *BaseTableValuedFunction) SupportedSignaturesUserFacingText() string

type BuiltinFunctionOptions

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

type Catalog

type Catalog interface {
	FullName() string
	FindTable(path []string) (Table, error)
	FindModel(path []string) (Model, error)
	FindConnection(path []string) (Connection, error)
	FindFunction(path []string) (*Function, error)
	FindTableValuedFunction(path []string) (TableValuedFunction, error)
	FindProcedure(path []string) (*Procedure, error)
	FindType(path []string) (Type, error)
	FindConstant(path []string) (Constant, int, error)
	FindConversion(from, to Type) (Conversion, error)
	ExtendedTypeSuperTypes(typ Type) (*TypeListView, error)
	SuggestTable(mistypedPath []string) string
	SuggestModel(mistypedPath []string) string
	SuggestFunction(mistypedPath []string) string
	SuggestTableValuedFunction(mistypedPath []string) string
	SuggestConstant(mistypedPath []string) string
}

type Column

type Column interface {
	Name() string
	FullName() string
	Type() Type
	TypeAnnotationMap() AnnotationMap
	IsPseudoColumn() bool
	IsWritableColumn() bool
	// contains filtered or unexported methods
}

type Connection

type Connection interface {
	Name() string
	FullName() string
	// contains filtered or unexported methods
}

type Constant

type Constant interface {
	Name() string
	FullName() string
	Type() Type
	DebugString() string
	NamePath() []string
	// contains filtered or unexported methods
}

type Conversion

type Conversion interface{}

type EnumType

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

func DatePartEnumType

func DatePartEnumType() *EnumType

func NormalizeModeEnumType

func NormalizeModeEnumType() *EnumType

func (EnumType) AsArray

func (t EnumType) AsArray() *ArrayType

func (EnumType) AsEnum

func (t EnumType) AsEnum() *EnumType

func (EnumType) AsStruct

func (t EnumType) AsStruct() *StructType

func (EnumType) DebugString

func (t EnumType) DebugString(details bool) string

func (EnumType) Equals

func (t EnumType) Equals(typ Type) bool

func (EnumType) Equivalent

func (t EnumType) Equivalent(typ Type) bool

func (*EnumType) FindName

func (t *EnumType) FindName(number int) (string, bool)

func (*EnumType) FindNumber

func (t *EnumType) FindNumber(name string) (int, bool)

func (EnumType) HasAnyFields

func (t EnumType) HasAnyFields() bool

func (EnumType) IsArray

func (t EnumType) IsArray() bool

func (EnumType) IsBigNumericType

func (t EnumType) IsBigNumericType() bool

func (EnumType) IsBool

func (t EnumType) IsBool() bool

func (EnumType) IsBytes

func (t EnumType) IsBytes() bool

func (EnumType) IsCivilDateOrTimeType

func (t EnumType) IsCivilDateOrTimeType() bool

func (EnumType) IsDate

func (t EnumType) IsDate() bool

func (EnumType) IsDatetime

func (t EnumType) IsDatetime() bool

func (EnumType) IsDouble

func (t EnumType) IsDouble() bool

func (EnumType) IsEnum

func (t EnumType) IsEnum() bool

func (EnumType) IsExtendedType

func (t EnumType) IsExtendedType() bool

func (EnumType) IsFeatureV12CivilTimeType

func (t EnumType) IsFeatureV12CivilTimeType() bool

func (EnumType) IsFloat

func (t EnumType) IsFloat() bool

func (EnumType) IsFloatingPoint

func (t EnumType) IsFloatingPoint() bool

func (EnumType) IsGeography

func (t EnumType) IsGeography() bool

func (EnumType) IsInt32

func (t EnumType) IsInt32() bool

func (EnumType) IsInt64

func (t EnumType) IsInt64() bool

func (EnumType) IsInteger

func (t EnumType) IsInteger() bool

func (EnumType) IsInteger32

func (t EnumType) IsInteger32() bool

func (EnumType) IsInteger64

func (t EnumType) IsInteger64() bool

func (EnumType) IsInterval

func (t EnumType) IsInterval() bool

func (EnumType) IsJson

func (t EnumType) IsJson() bool

func (EnumType) IsJsonType

func (t EnumType) IsJsonType() bool

func (EnumType) IsNumericType

func (t EnumType) IsNumericType() bool

func (EnumType) IsNumerical

func (t EnumType) IsNumerical() bool

func (EnumType) IsProto

func (t EnumType) IsProto() bool

func (EnumType) IsSignedInteger

func (t EnumType) IsSignedInteger() bool

func (EnumType) IsSimpleType

func (t EnumType) IsSimpleType() bool

func (EnumType) IsString

func (t EnumType) IsString() bool

func (EnumType) IsStruct

func (t EnumType) IsStruct() bool

func (EnumType) IsStructOrProto

func (t EnumType) IsStructOrProto() bool

func (EnumType) IsTime

func (t EnumType) IsTime() bool

func (EnumType) IsTimestamp

func (t EnumType) IsTimestamp() bool

func (EnumType) IsUint32

func (t EnumType) IsUint32() bool

func (EnumType) IsUint64

func (t EnumType) IsUint64() bool

func (EnumType) IsUnsignedInteger

func (t EnumType) IsUnsignedInteger() bool

func (EnumType) Kind

func (t EnumType) Kind() TypeKind

func (EnumType) NestingDepth

func (t EnumType) NestingDepth() int

func (EnumType) ShortTypeName

func (t EnumType) ShortTypeName(mode ProductMode) string

func (EnumType) SupportsEquality

func (t EnumType) SupportsEquality() bool

func (EnumType) SupportsGrouping

func (t EnumType) SupportsGrouping() bool

func (EnumType) SupportsOrdering

func (t EnumType) SupportsOrdering() bool

func (EnumType) SupportsPartitioning

func (t EnumType) SupportsPartitioning() bool

func (EnumType) TypeName

func (t EnumType) TypeName(mode ProductMode) string

func (EnumType) TypeNameWithParameters

func (t EnumType) TypeNameWithParameters(param *TypeParameters, mode ProductMode) (string, error)

func (EnumType) UsingFeatureV12CivilTimeType

func (t EnumType) UsingFeatureV12CivilTimeType() bool

func (EnumType) ValidateAndResolveTypeParameters

func (t EnumType) ValidateAndResolveTypeParameters(values []TypeParameterValue, mode ProductMode) (*TypeParameters, error)

func (EnumType) ValidateResolvedTypeParameters

func (t EnumType) ValidateResolvedTypeParameters(params *TypeParameters, mode ProductMode) error

type EnumerableCatalog

type EnumerableCatalog interface {
	Catalog
	Catalogs() ([]Catalog, error)
	Tables() ([]Table, error)
	Types() ([]Type, error)
	Functions() ([]Function, error)
	Conversions() ([]Conversion, error)
}

type EvaluatorTableIterator

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

type Function

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

Function interface identifies the functions available in a query engine. Each Function includes a set of FunctionSignatures, where a signature indicates:

  1. Argument and result types.
  2. A 'context' for the signature.

A Function also indicates the 'group' it belongs to.

The Function also includes <function_options_> for specifying additional resolution requirements, if any. Additionally, <function_options_> can identify a function alias/synonym that Catalogs must expose for function lookups by name.

func NewFunction

func NewFunction(namePath []string, group string, mode Mode, sigs []*FunctionSignature) *Function

Functions in a nested catalog should use the constructor with the <namePath>, identifying the full path name of the function including its containing catalog names.

These constructors perform ZETASQL_CHECK validations of basic invariants: * Scalar functions cannot support the OVER clause. * Analytic functions must support OVER clause. * Signatures must satisfy FunctionSignature.IsValidForFunction().

func (*Function) AddSignature

func (f *Function) AddSignature(sig *FunctionSignature)

AddSignature adds a function signature to an existing function.

func (*Function) AliasName

func (f *Function) AliasName() string

AliasName

func (*Function) ArgumentsAreCoercible

func (f *Function) ArgumentsAreCoercible() bool

func (*Function) DebugString

func (f *Function) DebugString(verbose bool) string

DebugString returns the function name. If <verbose> then also returns DebugString() of all its function signatures.

func (*Function) FullName

func (f *Function) FullName(includeGroup bool) string

FullName returns <function_name_path_> strings joined with '.', and if <include_group> is true then it is prefixed with the group name.

func (*Function) FunctionNamePath

func (f *Function) FunctionNamePath() []string

func (*Function) Group

func (f *Function) Group() string

Group returns the 'group' the function belongs to.

func (*Function) IsAggregate

func (f *Function) IsAggregate() bool

func (*Function) IsAnalytic

func (f *Function) IsAnalytic() bool

func (*Function) IsDeprecated

func (f *Function) IsDeprecated() bool

IsDeprecated

func (*Function) IsScalar

func (f *Function) IsScalar() bool

func (*Function) IsZetaSQLBuiltin

func (f *Function) IsZetaSQLBuiltin() bool

func (*Function) Mode

func (f *Function) Mode() Mode

func (*Function) Name

func (f *Function) Name() string

func (*Function) NumSignatures

func (f *Function) NumSignatures() int

NumSignatures returns the number of function signatures.

func (*Function) QualifiedSQLName

func (f *Function) QualifiedSQLName(capitalizeQualifier bool) string

QualifiedSQLName returns SQLName() prefixed with either 'operator ' or 'function ', and 'aggregate ' or 'analytic ' if appropriate. If <capitalize_qualifier> is true, then the first letter of the (first) qualifier is capitalized (i.e., 'Operator' vs. 'operator' and 'Analytic function' vs. 'analytic function'). A function uses the 'operator ' prefix if its name starts with '$'.

func (*Function) RequiresWindowOrdering

func (f *Function) RequiresWindowOrdering() bool

RequiresWindowOrdering returns true if ORDER BY must be specified in a window definition for this function.

func (*Function) ResetSignatures

func (f *Function) ResetSignatures(sigs []*FunctionSignature)

func (*Function) SQL

func (f *Function) SQL(inputs []string, sig *FunctionSignature) string

func (*Function) SQLName

func (f *Function) SQLName() string

SQLName returns an external 'SQL' name for the function, for use in error messages and anywhere else appropriate. If <function_options_> has its <sql_name> set then it returns <sql_name>. If <sql_name> is not set and Name() is an internal function name (starting with '$'), then it strips off the '$' and converts any '_' to ' '. Otherwise it simply returns Name() for ZetaSQL builtin functions and FullName() for non-builtin functions.

func (*Function) Signatures

func (f *Function) Signatures() []*FunctionSignature

Signatures returns all of the function signatures.

func (*Function) SupportsClampedBetweenModifier

func (f *Function) SupportsClampedBetweenModifier() bool

SupportsClampedBetweenModifier returns true if CLAMPED BETWEEN is allowed in the function arguments. Must only be true for differential privacy functions.

func (*Function) SupportsDistinctModifier

func (f *Function) SupportsDistinctModifier() bool

SupportsDistinctModifier returns true if DISTINCT is allowed in the function arguments.

func (*Function) SupportsHavingModifier

func (f *Function) SupportsHavingModifier() bool

SupportsHavingModifier returns true if HAVING is allowed in the function arguments.

func (*Function) SupportsLimitArguments

func (f *Function) SupportsLimitArguments() bool

SupportsLimitArguments returns true if LIMIT is allowed in the function arguments.

func (*Function) SupportsNullHandlingModifier

func (f *Function) SupportsNullHandlingModifier() bool

SupportsNullHandlingModifier returns true if IGNORE NULLS and RESPECT NULLS are allowed in the function arguments.

func (*Function) SupportsOrderingArguments

func (f *Function) SupportsOrderingArguments() bool

SupportsOrderingArguments returns true if order by is allowed in the function arguments.

func (*Function) SupportsOverClause

func (f *Function) SupportsOverClause() bool

SupportsOverClause returns true if it supports the OVER clause (i.e. this function can act as an analytic function). If true, the mode cannot be SCALAR.

func (*Function) SupportsSafeErrorMode

func (f *Function) SupportsSafeErrorMode() bool

SupportsSafeErrorMode returns true if this function supports SAFE_ERROR_MODE. See full comment on field definition.

func (*Function) SupportsWindowFraming

func (f *Function) SupportsWindowFraming() bool

SupportsWindowFraming returns true if window framing clause is allowed in a window definition for this function.

func (*Function) SupportsWindowOrdering

func (f *Function) SupportsWindowOrdering() bool

SupportsWindowOrdering returns true if ORDER BY is allowed in a window definition for this function.

type FunctionArgumentType

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

FunctionArgumentType a type for an argument or result value in a function signature. Types can be fixed or templated. Arguments can be marked as repeated (denoting it can occur zero or more times in a function invocation) or optional. Result types cannot be marked as repeated or optional. Type VOID is valid for the return type in Procedures and in DropFunctionStmtNode only; VOID is not allowed as the return type for Functions, and is never allowed as a argument type. A FunctionArgumentType is concrete if it is not templated and num_occurrences_ indicates how many times the argument appears in a concrete FunctionSignature. FunctionArgumentTypeOptions can be used to apply additional constraints on legal values for the argument.

func NewFunctionArgumentType

func NewFunctionArgumentType(typ Type, opt *FunctionArgumentTypeOptions) *FunctionArgumentType

func (*FunctionArgumentType) AllowCoercionFrom

func (t *FunctionArgumentType) AllowCoercionFrom(actualArgType Type) bool

func (*FunctionArgumentType) ArgumentName

func (t *FunctionArgumentType) ArgumentName() string

func (*FunctionArgumentType) Cardinality

func (t *FunctionArgumentType) Cardinality() ArgumentCardinality

func (*FunctionArgumentType) DebugString

func (t *FunctionArgumentType) DebugString(verbose bool) string

DebugString if verbose is true, include FunctionOptions modifiers.

func (*FunctionArgumentType) Default

func (t *FunctionArgumentType) Default() Value

Default returns default value provided in the argument option, or nil if the argument does not have a default value.

func (*FunctionArgumentType) HasArgumentName

func (t *FunctionArgumentType) HasArgumentName() bool

func (*FunctionArgumentType) HasDefault

func (t *FunctionArgumentType) HasDefault() bool

HasDefault returns TRUE if the argument has a default value provided in the argument option.

func (*FunctionArgumentType) IncrementNumOccurrences

func (t *FunctionArgumentType) IncrementNumOccurrences()

func (*FunctionArgumentType) IsConcrete

func (t *FunctionArgumentType) IsConcrete() bool

IsConcrete returns true if kind is ARG_TYPE_FIXED or ARG_TYPE_RELATION and the number of occurrences is greater than -1.

func (*FunctionArgumentType) IsConnection

func (t *FunctionArgumentType) IsConnection() bool

func (*FunctionArgumentType) IsDescriptor

func (t *FunctionArgumentType) IsDescriptor() bool

func (*FunctionArgumentType) IsFixedRelation

func (t *FunctionArgumentType) IsFixedRelation() bool

func (*FunctionArgumentType) IsLambda

func (t *FunctionArgumentType) IsLambda() bool

func (*FunctionArgumentType) IsModel

func (t *FunctionArgumentType) IsModel() bool

func (*FunctionArgumentType) IsRelation

func (t *FunctionArgumentType) IsRelation() bool

func (*FunctionArgumentType) IsScalar

func (t *FunctionArgumentType) IsScalar() bool

func (*FunctionArgumentType) IsTemplated

func (t *FunctionArgumentType) IsTemplated() bool

func (*FunctionArgumentType) IsValid

func (t *FunctionArgumentType) IsValid(mode ProductMode) error

IsValid checks concrete arguments to validate the number of occurrences.

func (*FunctionArgumentType) IsVoid

func (t *FunctionArgumentType) IsVoid() bool

func (*FunctionArgumentType) Kind

func (*FunctionArgumentType) Lambda

Lambda returns information about a lambda typed function argument.

func (*FunctionArgumentType) MustBeConstant

func (t *FunctionArgumentType) MustBeConstant() bool

func (*FunctionArgumentType) NumOccurrences

func (t *FunctionArgumentType) NumOccurrences() int

func (*FunctionArgumentType) Optional

func (t *FunctionArgumentType) Optional() bool

func (*FunctionArgumentType) Options

func (*FunctionArgumentType) Repeated

func (t *FunctionArgumentType) Repeated() bool

func (*FunctionArgumentType) Required

func (t *FunctionArgumentType) Required() bool

func (*FunctionArgumentType) SQLDeclaration

func (t *FunctionArgumentType) SQLDeclaration(mode ProductMode) string

SQLDeclaration get the SQL declaration for this argument, including all options. The result is formatted as SQL that can be included inside a function signature in CREATE FUNCTION, DROP FUNCTION, etc, if possible.

func (*FunctionArgumentType) SetNumOccurrences

func (t *FunctionArgumentType) SetNumOccurrences(num int)

func (*FunctionArgumentType) TemplatedKindIsRelated

func (t *FunctionArgumentType) TemplatedKindIsRelated(kind SignatureArgumentKind) bool

TemplatedKindIsRelated returns TRUE if kind() can be used to derive something about kind. For example, if kind() is ARG_ARRAY_TYPE_ANY_1, it can be used to derive information about ARG_TYPE_ANY_1, but not ARG_TYPE_ANY_2. Likewise, a proto map key can be used to derive information about the map itself, but not about the map value.

func (*FunctionArgumentType) Type

func (t *FunctionArgumentType) Type() Type

Type returns nil if kind is not ARG_TYPE_FIXED or ARG_TYPE_LAMBDA. If kind is ARG_TYPE_LAMBDA, returns the type of lambda body type, which could be nil if the body type is templated.

func (*FunctionArgumentType) UserFacingName

func (t *FunctionArgumentType) UserFacingName(mode ProductMode) string

UserFacingName returns argument type name to be used in error messages. This either would be a scalar short type name - DATE, INT64, BYTES etc. or STRUCT, PROTO, ENUM for complex type names, or ANY when any data type is allowed.

func (*FunctionArgumentType) UserFacingNameWithCardinality

func (t *FunctionArgumentType) UserFacingNameWithCardinality(mode ProductMode) string

UserFacingNameWithCardinality returns user facing text for the argument including argument cardinality (to be used in error message):

  • required, just argument type, e.g. INT64
  • optional, argument type enclosed in [], e.g. INT64
  • repeated, argument type enclosed in [] with ..., e.g. [INT64, ...]

type FunctionArgumentTypeOptions

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

FunctionArgumentTypeOptions specifies options on a function argument, including argument cardinality. This includes some options that are used to specify argument values that are illegal and should cause an analysis error.

func NewFunctionArgumentTypeOptions

func NewFunctionArgumentTypeOptions(cardinality ArgumentCardinality) *FunctionArgumentTypeOptions

func (*FunctionArgumentTypeOptions) ArgumentCollationMode

func (o *FunctionArgumentTypeOptions) ArgumentCollationMode() ArgumentCollationMode

func (*FunctionArgumentTypeOptions) ArgumentName

func (o *FunctionArgumentTypeOptions) ArgumentName() string

func (*FunctionArgumentTypeOptions) ArgumentNameIsMandatory

func (o *FunctionArgumentTypeOptions) ArgumentNameIsMandatory() bool

func (*FunctionArgumentTypeOptions) ArgumentNameParseLocation

func (o *FunctionArgumentTypeOptions) ArgumentNameParseLocation() *ParseLocationRange

ArgumentNameParseLocation gets the ParseLocationRange of the argument name.

func (*FunctionArgumentTypeOptions) ArgumentTypeParseLocation

func (o *FunctionArgumentTypeOptions) ArgumentTypeParseLocation() *ParseLocationRange

ArgumentTypeParseLocation gets the ParseLocationRange of the argument type.

func (*FunctionArgumentTypeOptions) Cardinality

func (*FunctionArgumentTypeOptions) ClearDefault

ClearDefault clears the default argument value set to this object.

func (*FunctionArgumentTypeOptions) Default

func (o *FunctionArgumentTypeOptions) Default() Value

Default gets the default value of this argument.

func (*FunctionArgumentTypeOptions) ExtraRelationInputColumnsAllowed

func (o *FunctionArgumentTypeOptions) ExtraRelationInputColumnsAllowed() bool

func (*FunctionArgumentTypeOptions) HasArgumentName

func (o *FunctionArgumentTypeOptions) HasArgumentName() bool

func (*FunctionArgumentTypeOptions) HasDefault

func (o *FunctionArgumentTypeOptions) HasDefault() bool

HasDefault returns true if a default value has been defined for this argument.

func (*FunctionArgumentTypeOptions) HasMaxValue

func (o *FunctionArgumentTypeOptions) HasMaxValue() bool

func (*FunctionArgumentTypeOptions) HasMinValue

func (o *FunctionArgumentTypeOptions) HasMinValue() bool

func (*FunctionArgumentTypeOptions) HasRelationInputSchema

func (o *FunctionArgumentTypeOptions) HasRelationInputSchema() bool

func (*FunctionArgumentTypeOptions) IsNotAggregate

func (o *FunctionArgumentTypeOptions) IsNotAggregate() bool

func (*FunctionArgumentTypeOptions) MaxValue

func (o *FunctionArgumentTypeOptions) MaxValue() int64

func (*FunctionArgumentTypeOptions) MinValue

func (o *FunctionArgumentTypeOptions) MinValue() int64

func (*FunctionArgumentTypeOptions) MustBeConstant

func (o *FunctionArgumentTypeOptions) MustBeConstant() bool

func (*FunctionArgumentTypeOptions) MustBeNonNull

func (o *FunctionArgumentTypeOptions) MustBeNonNull() bool

func (*FunctionArgumentTypeOptions) MustSupportEquality

func (o *FunctionArgumentTypeOptions) MustSupportEquality() bool

func (*FunctionArgumentTypeOptions) MustSupportGrouping

func (o *FunctionArgumentTypeOptions) MustSupportGrouping() bool

func (*FunctionArgumentTypeOptions) MustSupportOrdering

func (o *FunctionArgumentTypeOptions) MustSupportOrdering() bool

func (*FunctionArgumentTypeOptions) OptionsDebugString

func (o *FunctionArgumentTypeOptions) OptionsDebugString() string

OptionsDebugString return a string describing the options (not including cardinality). If no options are set, this returns an empty string. Otherwise, includes a leading space.

func (*FunctionArgumentTypeOptions) ProcedureArgumentMode

func (o *FunctionArgumentTypeOptions) ProcedureArgumentMode() ProcedureArgumentMode

func (*FunctionArgumentTypeOptions) ResolveDescriptorNamesTableOffset

func (o *FunctionArgumentTypeOptions) ResolveDescriptorNamesTableOffset() int

func (*FunctionArgumentTypeOptions) SQLDeclaration

func (o *FunctionArgumentTypeOptions) SQLDeclaration(mode ProductMode) string

SQLDeclaration get the SQL declaration for these options. The result is formatted as SQL that can be included inside a function signature in CREATE FUNCTION, DROP FUNCTION, etc, if possible.

func (*FunctionArgumentTypeOptions) SetArgumentCollationMode

func (*FunctionArgumentTypeOptions) SetArgumentName

func (*FunctionArgumentTypeOptions) SetArgumentNameIsMandatory

func (o *FunctionArgumentTypeOptions) SetArgumentNameIsMandatory(value bool) *FunctionArgumentTypeOptions

func (*FunctionArgumentTypeOptions) SetArgumentNameParseLocation

func (o *FunctionArgumentTypeOptions) SetArgumentNameParseLocation(locRange *ParseLocationRange) *FunctionArgumentTypeOptions

SetArgumentNameParseLocation sets the ParseLocationRange of the argument name.

func (*FunctionArgumentTypeOptions) SetArgumentTypeParseLocation

func (o *FunctionArgumentTypeOptions) SetArgumentTypeParseLocation(locRange *ParseLocationRange) *FunctionArgumentTypeOptions

SetArgumentTypeParseLocation sets the ParseLocationRange of the argument type.

func (*FunctionArgumentTypeOptions) SetCardinality

func (*FunctionArgumentTypeOptions) SetDefault

SetDefault sets the default value of this argument. Only optional arguments can (optionally) have default values. Restrictions on the default values:

  • For fixed-typed arguments, the type of <default_value> must be Equals to the type of the argument.
  • Non-expression-typed templated arguments (e.g., tables, connections, models, etc.) cannot have default values.

Note that (in the near future), an optional argument that has a default value and is omitted in a function call will be resolved as if the default value is specified.

Also note that the type of <default_value> must outlive this object as well as all the FunctionSignature instances created using this object.

func (*FunctionArgumentTypeOptions) SetExtraRelationInputColumnsAllowed

func (o *FunctionArgumentTypeOptions) SetExtraRelationInputColumnsAllowed(v bool) *FunctionArgumentTypeOptions

func (*FunctionArgumentTypeOptions) SetIsNotAggregate

func (*FunctionArgumentTypeOptions) SetMaxValue

func (*FunctionArgumentTypeOptions) SetMinValue

func (*FunctionArgumentTypeOptions) SetMustBeConstant

func (*FunctionArgumentTypeOptions) SetMustBeNonNull

func (*FunctionArgumentTypeOptions) SetMustSupportEquality

func (o *FunctionArgumentTypeOptions) SetMustSupportEquality(v bool) *FunctionArgumentTypeOptions

func (*FunctionArgumentTypeOptions) SetMustSupportGrouping

func (o *FunctionArgumentTypeOptions) SetMustSupportGrouping(v bool) *FunctionArgumentTypeOptions

func (*FunctionArgumentTypeOptions) SetMustSupportOrdering

func (o *FunctionArgumentTypeOptions) SetMustSupportOrdering(v bool) *FunctionArgumentTypeOptions

func (*FunctionArgumentTypeOptions) SetProcedureArgumentMode

func (*FunctionArgumentTypeOptions) SetResolveDescriptorNamesTableOffset

func (o *FunctionArgumentTypeOptions) SetResolveDescriptorNamesTableOffset(tableOffset int) *FunctionArgumentTypeOptions

func (*FunctionArgumentTypeOptions) SetUsesArrayElementForCollation

func (o *FunctionArgumentTypeOptions) SetUsesArrayElementForCollation(v bool) *FunctionArgumentTypeOptions

func (*FunctionArgumentTypeOptions) UsesArrayElementForCollation

func (o *FunctionArgumentTypeOptions) UsesArrayElementForCollation() bool

type FunctionSignature

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

FunctionSignature identifies the argument Types and other properties per overload of a Function (or a similar object, like a Procedure or TableValuedFunction). A FunctionSignature is concrete if it identifies the exact number and fixed Types of its arguments and results. A FunctionSignature can be non-concrete, but have concrete arguments. A FunctionSignature can be abstract, specifying templated types and identifying arguments as repeated or optional. Optional arguments must appear at the end of the argument list.

If multiple arguments are repeated, they must be consecutive and are treated as if they repeat together. To illustrate, consider the expression: 'CASE WHEN <bool_expr_1> THEN <expr_1>

WHEN <bool_expr_2> THEN <expr_2>
...
ELSE <expr_n> END'.

This expression has the following signature <arguments>:

arg1: <bool> repeated - WHEN
arg2: <any_type_1> repeated - THEN
arg3: <any_type_1> optional - ELSE
result: <any_type_1>

The WHEN and THEN arguments (arg1 and arg2) repeat together and must occur at least once, and the ELSE is optional. The THEN, ELSE, and RESULT types can be any type, but must be the same type.

In order to avoid potential ambiguity, the number of optional arguments must be less than the number of repeated arguments.

The FunctionSignature also includes <options> for specifying additional signature matching requirements, if any.

func NewFunctionSignature

func NewFunctionSignature(resultType *FunctionArgumentType, args []*FunctionArgumentType) *FunctionSignature

func (*FunctionSignature) AllArgumentsHaveDefaults

func (s *FunctionSignature) AllArgumentsHaveDefaults() bool

Returns true if all the arguments in the signature have default values. Note this function returns true when the signature has no arguments.

func (*FunctionSignature) Arguments

func (s *FunctionSignature) Arguments() []*FunctionArgumentType

func (*FunctionSignature) ConcreteArguments

func (s *FunctionSignature) ConcreteArguments() []*FunctionArgumentType

ConcreteArguments returns concrete argument. Differs from argments above in that repeated and optional arguments are fully expanded in a concrete signature. Requires that the signature has concrete arguments.

func (*FunctionSignature) DebugString

func (s *FunctionSignature) DebugString(functionName string, verbose bool) string

DebugString if verbose is true, include FunctionOptions modifiers.

func (*FunctionSignature) FirstRepeatedArgumentIndex

func (s *FunctionSignature) FirstRepeatedArgumentIndex() int

FirstRepeatedArgumentIndex gets the first repeated argument index. If there are no repeated arguments then returns -1.

func (*FunctionSignature) HasConcreteArguments

func (s *FunctionSignature) HasConcreteArguments() bool

HasConcreteArguments returns TRUE if all arguments are concrete.

func (*FunctionSignature) IsConcrete

func (s *FunctionSignature) IsConcrete() bool

func (*FunctionSignature) IsDeprecated

func (s *FunctionSignature) IsDeprecated() bool

func (*FunctionSignature) IsInternal

func (s *FunctionSignature) IsInternal() bool

func (*FunctionSignature) IsTemplated

func (s *FunctionSignature) IsTemplated() bool

IsTemplated returns true if this function signature contains any templated arguments.

func (*FunctionSignature) IsValid

func (s *FunctionSignature) IsValid(mode ProductMode) error

IsValid determines whether the argument and result types are valid. Additionally, it requires that all repeated arguments are consecutive, and all optional arguments appear at the end. There may be required arguments before the repeated arguments, and there may be required arguments between the repeated and optional arguments.

func (*FunctionSignature) IsValidForFunction

func (s *FunctionSignature) IsValidForFunction() error

IsValidForFunction checks specific invariants for the argument and return types for regular function calls. The latter may use relation types (returning true for (*FunctionArgumentType).IsRelation()) but the former may not.

func (*FunctionSignature) IsValidForProcedure

func (s *FunctionSignature) IsValidForProcedure() error

IsValidForProcedure checks if this signature is valid for Procedure. Procedure may only have fixed required arguments.

func (*FunctionSignature) IsValidForTableValuedFunction

func (s *FunctionSignature) IsValidForTableValuedFunction() error

IsValidForTableValuedFunction checks specific invariants for the argument and return types for table-valued function calls. The latter may use relation types (returning true for (*FunctionArgumentType).IsRelation()) but the former may not.

func (*FunctionSignature) LastRepeatedArgumentIndex

func (s *FunctionSignature) LastRepeatedArgumentIndex() int

LastRepeatedArgumentIndex gets the first repeated argument index. If there are no repeated arguments then returns -1.

func (*FunctionSignature) NumOptionalArguments

func (s *FunctionSignature) NumOptionalArguments() int

NumOptionalArguments gets the number of optional arguments.

func (*FunctionSignature) NumRepeatedArguments

func (s *FunctionSignature) NumRepeatedArguments() int

NumRepeatedArguments gets the number of repeated arguments.

func (*FunctionSignature) NumRequiredArguments

func (s *FunctionSignature) NumRequiredArguments() int

NumRequiredArguments gets the number of required arguments.

func (*FunctionSignature) Options

func (*FunctionSignature) ResultType

func (s *FunctionSignature) ResultType() *FunctionArgumentType

func (*FunctionSignature) SQLDeclaration

func (s *FunctionSignature) SQLDeclaration(argumentNames []string, mode ProductMode) string

SQLDeclaration get the SQL declaration for this signature, including all options. For each argument in the signature, the name will be taken from the corresponding entry of <argument_names> if present. An empty <argument_names> will result in a signature with just type names. The result is formatted as "(arg_name type, ...) RETURNS type", which is valid to use in CREATE FUNCTION, DROP FUNCTION, etc, if possible.

func (*FunctionSignature) SetConcreteResultType

func (s *FunctionSignature) SetConcreteResultType(typ Type)

func (*FunctionSignature) SetIsDeprecated

func (s *FunctionSignature) SetIsDeprecated(v bool)

type FunctionSignatureOptions

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

type Mode

type Mode int
const (
	ScalarMode    Mode = 1
	AggregateMode Mode = 2
	AnalyticMode  Mode = 3
)

type Model

type Model interface {
	Name() string
	FullName() string
	NumInputs() uint64
	Input(int) Column
	NumOutputs() uint64
	Output(int) Column
	FindInputByName(name string) Column
	FindOutputByName(name string) Column
	SerializationID() int64
	// contains filtered or unexported methods
}

type ParseLocationPoint

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

func (*ParseLocationPoint) ByteOffset

func (p *ParseLocationPoint) ByteOffset() int

func (*ParseLocationPoint) Filename

func (p *ParseLocationPoint) Filename() string

func (*ParseLocationPoint) String

func (p *ParseLocationPoint) String() string

type ParseLocationRange

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

func (*ParseLocationRange) End

func (*ParseLocationRange) Start

func (*ParseLocationRange) String

func (r *ParseLocationRange) String() string

type Procedure

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

func NewProcedure

func NewProcedure(namePath []string, signature *FunctionSignature) *Procedure

func (*Procedure) FullName

func (p *Procedure) FullName() string

func (*Procedure) Name

func (p *Procedure) Name() string

func (*Procedure) NamePath

func (p *Procedure) NamePath() []string

func (*Procedure) Signature

func (p *Procedure) Signature() *FunctionSignature

func (*Procedure) SupportedSignatureUserFacingText

func (p *Procedure) SupportedSignatureUserFacingText(mode ProductMode) string

type ProcedureArgumentMode

type ProcedureArgumentMode int
const (
	NotSetProcedureArgumentMode ProcedureArgumentMode = 0
	InProcedureArgumentMode     ProcedureArgumentMode = 1
	OutProcedureArgumentMode    ProcedureArgumentMode = 2
	InOutProcedureArgumentMode  ProcedureArgumentMode = 3
)

type ProductMode

type ProductMode int

ProductMode this identifies whether ZetaSQL works in INTERNAL (inside Google) mode, or in EXTERNAL (exposed to non-Googlers in the products such as Cloud).

const (
	ProductInternal ProductMode = 0
	ProductExternal ProductMode = 1
)

type SQLTableValuedFunction

type SQLTableValuedFunction struct {
	*BaseTableValuedFunction
}

func NewSQLTableValuedFunction

func NewSQLTableValuedFunction(createTableFunctionStmtPtr unsafe.Pointer) (*SQLTableValuedFunction, error)

type SignatureArgumentKind

type SignatureArgumentKind int
const (
	// ArgTypeFixed a specific concrete Type.
	ArgTypeFixed SignatureArgumentKind = 0

	// ArgTypeAny1 templated type.  All arguments with this type must be the same type.
	// For example,
	//   IF <bool> THEN <T1> ELSE <T1> END -> <T1>
	ArgTypeAny1 SignatureArgumentKind = 1

	// ArgTypeAny2 templated type.  All arguments with this type must be the same type.
	// For example,
	//   CASE <T1> WHEN <T1> THEN <T2>
	//             WHEN <T1> THEN <T2> ELSE <T2> END -> <T2>
	ArgTypeAny2 SignatureArgumentKind = 2

	// ArgArrayTypeAny1 templated array type.  All arguments with this type must be the same
	// type.  Additionally, all arguments with this type must be an array
	// whose element type matches arguments with ARG_TYPE_ANY_1 type.
	// For example,
	//   FIRST(<array<T1>>) -> <T1>
	ArgArrayTypeAny1 SignatureArgumentKind = 3

	// ArgArrayTypeAny2 templated array type.  All arguments with this type must be the same
	// type.  Additionally, all arguments with this type must be an array
	// whose element type matches arguments with ARG_TYPE_ANY_2 type.
	// For example,
	//   LAST(<array<T2>>) -> <T2>
	ArgArrayTypeAny2 SignatureArgumentKind = 4

	// ArgProtoAny templated proto type. All arguments with this type must be the same type.
	// e.g.:
	//   DEBUGSTRING(<proto>) -> <string>
	ArgProtoAny SignatureArgumentKind = 5

	// ArgStructAny templated struct type. All arguments with this type must be the same type.
	// e.g.:
	//   DEBUGSTRING(<struct>) -> <string>
	ArgStructAny SignatureArgumentKind = 6

	// ArgEnumAny templated enum type. All arguments with this type must be the same type.
	// e.g.:
	//   ENUM_NAME(<enum>, 5) -> <string>
	ArgEnumAny SignatureArgumentKind = 7

	// ArgTypeArbitrary arbitrary Type. Multiple arguments with this type do not need to be the
	// same type. This does not include relation arguments.
	ArgTypeArbitrary SignatureArgumentKind = 8

	// ArgTypeRelation relation type. This is only valid for table-valued functions (TVFs). This
	// specifies a relation of any number and types of columns. Multiple arguments
	// with this type do not necessarily represent the same relation.
	//
	// Background: each TVF may accept value or relation arguments. The signature
	// specifies whether each argument should be a value or a relation. For a
	// value argument, the signature may use one of the other
	// SignatureArgumentKinds in this list.
	//
	// For more information, please see table_valued_function.h.
	ArgTypeRelation SignatureArgumentKind = 9

	// ArgTypeVoid this is used for a non-existent return type for signatures that do not
	// return a value.  This can only be used as a return type, and only in
	// contexts where there is no return (e.g. Procedures, or signatures in DropFunctionStmtNode).
	ArgTypeVoid SignatureArgumentKind = 10

	// ArgTypeModel model type. This is only valid for table-valued functions (TVFs). This
	// specifies a model for ML-related TVFs.
	ArgTypeModel SignatureArgumentKind = 11

	// ArgTypeConnection connection type. This is only valid for table-valued functions (TVFs). This
	// specifies a connection for EXTERNAL_QUERY TVF.
	ArgTypeConnection SignatureArgumentKind = 12

	// ArgTypeDescriptor descriptor type. This is only valid for table-valued functions (TVFs). This
	// specifies a descriptor with a list of column names.
	ArgTypeDescriptor SignatureArgumentKind = 13

	// ArgProtoMapAny templated proto map type. This is an array of protos where the proto
	// is a map entry. It has a key field and a value field. This kind allows
	// inference of the key and value field types from the map field type, as
	// in this expression:
	//
	// ARG_PROTO_MAP_ANY[KEY(ARG_PROTO_MAP_KEY_ANY)] ->
	// ARG_PROTO_MAP_VALUE_ANY
	ArgProtoMapAny SignatureArgumentKind = 14

	// ArgProtoMapKeyAny the key type of a proto map that matches ARG_PROTO_MAP_ANY.
	ArgProtoMapKeyAny SignatureArgumentKind = 15

	// ArgProtoMapValueAny the value type of a proto map that matches ARG_PROTO_MAP_ANY.
	ArgProtoMapValueAny SignatureArgumentKind = 16

	// ArgTypeLambda lambda type. This is only valid for lambda function arguments. This
	// specifies a lambda with a list of argument types and a body type.
	ArgTypeLambda SignatureArgumentKind = 17
)

type SimpleCatalog

type SimpleCatalog struct {
	*BaseEnumerableCatalog
}

func NewSimpleCatalog

func NewSimpleCatalog(name string) *SimpleCatalog

func (*SimpleCatalog) AddCatalog

func (c *SimpleCatalog) AddCatalog(catalog Catalog)

func (*SimpleCatalog) AddCatalogWithName

func (c *SimpleCatalog) AddCatalogWithName(name string, catalog Catalog)

func (*SimpleCatalog) AddConnection

func (c *SimpleCatalog) AddConnection(conn Connection)

func (*SimpleCatalog) AddConnectionWithName

func (c *SimpleCatalog) AddConnectionWithName(name string, conn Connection)

func (*SimpleCatalog) AddConstant

func (c *SimpleCatalog) AddConstant(cons Constant)

func (*SimpleCatalog) AddConstantWithName

func (c *SimpleCatalog) AddConstantWithName(name string, cons Constant)

func (*SimpleCatalog) AddFunction

func (c *SimpleCatalog) AddFunction(fn *Function)

func (*SimpleCatalog) AddFunctionWithName

func (c *SimpleCatalog) AddFunctionWithName(name string, fn *Function)

func (*SimpleCatalog) AddModel

func (c *SimpleCatalog) AddModel(model Model)

func (*SimpleCatalog) AddModelWithName

func (c *SimpleCatalog) AddModelWithName(name string, model Model)

func (*SimpleCatalog) AddProcedure

func (c *SimpleCatalog) AddProcedure(proc *Procedure)

func (*SimpleCatalog) AddProcedureWithName

func (c *SimpleCatalog) AddProcedureWithName(name string, proc *Procedure)

func (*SimpleCatalog) AddTable

func (c *SimpleCatalog) AddTable(table Table)

func (*SimpleCatalog) AddTableValuedFunction

func (c *SimpleCatalog) AddTableValuedFunction(fn TableValuedFunction)

func (*SimpleCatalog) AddTableValuedFunctionWithName

func (c *SimpleCatalog) AddTableValuedFunctionWithName(name string, fn TableValuedFunction)

func (*SimpleCatalog) AddTableWithName

func (c *SimpleCatalog) AddTableWithName(name string, table Table)

func (*SimpleCatalog) AddType

func (c *SimpleCatalog) AddType(name string, typ Type)

func (*SimpleCatalog) AddTypeIfNotPresent

func (c *SimpleCatalog) AddTypeIfNotPresent(name string, typ Type) bool

func (*SimpleCatalog) AddZetaSQLBuiltinFunctions

func (c *SimpleCatalog) AddZetaSQLBuiltinFunctions(opt *BuiltinFunctionOptions)

func (*SimpleCatalog) Catalog

func (c *SimpleCatalog) Catalog(name string) (*SimpleCatalog, error)

func (*SimpleCatalog) CatalogNames

func (c *SimpleCatalog) CatalogNames() []string

func (*SimpleCatalog) Catalogs

func (c *SimpleCatalog) Catalogs() ([]Catalog, error)

func (*SimpleCatalog) Connection

func (c *SimpleCatalog) Connection(name string) (Connection, error)

func (*SimpleCatalog) Constant

func (c *SimpleCatalog) Constant(name string) (Constant, error)

func (*SimpleCatalog) ConstantNames

func (c *SimpleCatalog) ConstantNames() []string

func (*SimpleCatalog) Constants

func (c *SimpleCatalog) Constants() ([]Constant, error)

func (*SimpleCatalog) Function

func (c *SimpleCatalog) Function(name string) (*Function, error)

func (*SimpleCatalog) FunctionNames

func (c *SimpleCatalog) FunctionNames() []string

func (*SimpleCatalog) Functions

func (c *SimpleCatalog) Functions() ([]*Function, error)

func (*SimpleCatalog) Model

func (c *SimpleCatalog) Model(name string) (Model, error)

func (*SimpleCatalog) Procedure

func (c *SimpleCatalog) Procedure(name string) (*Procedure, error)

func (*SimpleCatalog) Procedures

func (c *SimpleCatalog) Procedures() []*Procedure

func (*SimpleCatalog) Table

func (c *SimpleCatalog) Table(name string) (Table, error)

func (*SimpleCatalog) TableNames

func (c *SimpleCatalog) TableNames() []string

func (*SimpleCatalog) TableValuedFunction

func (c *SimpleCatalog) TableValuedFunction(name string) (TableValuedFunction, error)

func (*SimpleCatalog) TableValuedFunctionNames

func (c *SimpleCatalog) TableValuedFunctionNames() []string

func (*SimpleCatalog) TableValuedFunctions

func (c *SimpleCatalog) TableValuedFunctions() []TableValuedFunction

func (*SimpleCatalog) Tables

func (c *SimpleCatalog) Tables() ([]Table, error)

func (*SimpleCatalog) Type

func (c *SimpleCatalog) Type(name string) (Type, error)

func (*SimpleCatalog) Types

func (c *SimpleCatalog) Types() ([]Type, error)

type SimpleColumn

type SimpleColumn struct {
	*BaseColumn
}

func NewSimpleColumn

func NewSimpleColumn(tableName, name string, typ Type) *SimpleColumn

func NewSimpleColumnWithOpt

func NewSimpleColumnWithOpt(tableName, name string, typ Type, isPseudoColumn, isWritableColumn bool) *SimpleColumn

func (*SimpleColumn) AnnotatedType

func (c *SimpleColumn) AnnotatedType() *AnnotatedType

func (*SimpleColumn) SetIsPseudoColumn

func (c *SimpleColumn) SetIsPseudoColumn(v bool)

type SimpleModel

type SimpleModel struct {
	*BaseModel
}

func NewSimpleModel

func NewSimpleModel(name string, inputs []Column, outputs []Column) *SimpleModel

func (*SimpleModel) AddInput

func (m *SimpleModel) AddInput(column Column) error

func (*SimpleModel) AddOutput

func (m *SimpleModel) AddOutput(column Column) error

type SimpleTable

type SimpleTable struct {
	*BaseTable
}

func NewSimpleTable

func NewSimpleTable(name string, columns []Column) *SimpleTable

func (*SimpleTable) AddColumn

func (t *SimpleTable) AddColumn(col Column) error

func (*SimpleTable) AllowAnonymousColumnName

func (t *SimpleTable) AllowAnonymousColumnName() bool

func (*SimpleTable) AllowDuplicateColumnNames

func (t *SimpleTable) AllowDuplicateColumnNames() bool

func (*SimpleTable) SetAllowAnonymousColumnName

func (t *SimpleTable) SetAllowAnonymousColumnName(value bool) error

func (*SimpleTable) SetAllowDuplicateColumnNames

func (t *SimpleTable) SetAllowDuplicateColumnNames(value bool) error

func (*SimpleTable) SetFullName

func (t *SimpleTable) SetFullName(fullName string) error

func (*SimpleTable) SetIsValueTable

func (t *SimpleTable) SetIsValueTable(value bool)

func (*SimpleTable) SetPrimaryKey

func (t *SimpleTable) SetPrimaryKey(primaryKey []int) error

type StructAnnotationMap

type StructAnnotationMap struct {
	*BaseAnnotationMap
}

type StructField

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

func NewStructField

func NewStructField(name string, typ Type) *StructField

func (*StructField) Name

func (f *StructField) Name() string

func (*StructField) Type

func (f *StructField) Type() Type

type StructType

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

func NewStructType

func NewStructType(fields []*StructField) (*StructType, error)

func (StructType) AsArray

func (t StructType) AsArray() *ArrayType

func (StructType) AsEnum

func (t StructType) AsEnum() *EnumType

func (StructType) AsStruct

func (t StructType) AsStruct() *StructType

func (StructType) DebugString

func (t StructType) DebugString(details bool) string

func (StructType) Equals

func (t StructType) Equals(typ Type) bool

func (StructType) Equivalent

func (t StructType) Equivalent(typ Type) bool

func (*StructType) Field

func (t *StructType) Field(i int) *StructField

func (*StructType) Fields

func (t *StructType) Fields() []*StructField

func (StructType) HasAnyFields

func (t StructType) HasAnyFields() bool

func (StructType) IsArray

func (t StructType) IsArray() bool

func (StructType) IsBigNumericType

func (t StructType) IsBigNumericType() bool

func (StructType) IsBool

func (t StructType) IsBool() bool

func (StructType) IsBytes

func (t StructType) IsBytes() bool

func (StructType) IsCivilDateOrTimeType

func (t StructType) IsCivilDateOrTimeType() bool

func (StructType) IsDate

func (t StructType) IsDate() bool

func (StructType) IsDatetime

func (t StructType) IsDatetime() bool

func (StructType) IsDouble

func (t StructType) IsDouble() bool

func (StructType) IsEnum

func (t StructType) IsEnum() bool

func (StructType) IsExtendedType

func (t StructType) IsExtendedType() bool

func (StructType) IsFeatureV12CivilTimeType

func (t StructType) IsFeatureV12CivilTimeType() bool

func (StructType) IsFloat

func (t StructType) IsFloat() bool

func (StructType) IsFloatingPoint

func (t StructType) IsFloatingPoint() bool

func (StructType) IsGeography

func (t StructType) IsGeography() bool

func (StructType) IsInt32

func (t StructType) IsInt32() bool

func (StructType) IsInt64

func (t StructType) IsInt64() bool

func (StructType) IsInteger

func (t StructType) IsInteger() bool

func (StructType) IsInteger32

func (t StructType) IsInteger32() bool

func (StructType) IsInteger64

func (t StructType) IsInteger64() bool

func (StructType) IsInterval

func (t StructType) IsInterval() bool

func (StructType) IsJson

func (t StructType) IsJson() bool

func (StructType) IsJsonType

func (t StructType) IsJsonType() bool

func (StructType) IsNumericType

func (t StructType) IsNumericType() bool

func (StructType) IsNumerical

func (t StructType) IsNumerical() bool

func (StructType) IsProto

func (t StructType) IsProto() bool

func (StructType) IsSignedInteger

func (t StructType) IsSignedInteger() bool

func (StructType) IsSimpleType

func (t StructType) IsSimpleType() bool

func (StructType) IsString

func (t StructType) IsString() bool

func (StructType) IsStruct

func (t StructType) IsStruct() bool

func (StructType) IsStructOrProto

func (t StructType) IsStructOrProto() bool

func (StructType) IsTime

func (t StructType) IsTime() bool

func (StructType) IsTimestamp

func (t StructType) IsTimestamp() bool

func (StructType) IsUint32

func (t StructType) IsUint32() bool

func (StructType) IsUint64

func (t StructType) IsUint64() bool

func (StructType) IsUnsignedInteger

func (t StructType) IsUnsignedInteger() bool

func (StructType) Kind

func (t StructType) Kind() TypeKind

func (StructType) NestingDepth

func (t StructType) NestingDepth() int

func (*StructType) NumFields

func (t *StructType) NumFields() int

func (StructType) ShortTypeName

func (t StructType) ShortTypeName(mode ProductMode) string

func (StructType) SupportsEquality

func (t StructType) SupportsEquality() bool

func (StructType) SupportsGrouping

func (t StructType) SupportsGrouping() bool

func (StructType) SupportsOrdering

func (t StructType) SupportsOrdering() bool

func (StructType) SupportsPartitioning

func (t StructType) SupportsPartitioning() bool

func (StructType) TypeName

func (t StructType) TypeName(mode ProductMode) string

func (StructType) TypeNameWithParameters

func (t StructType) TypeNameWithParameters(param *TypeParameters, mode ProductMode) (string, error)

func (StructType) UsingFeatureV12CivilTimeType

func (t StructType) UsingFeatureV12CivilTimeType() bool

func (StructType) ValidateAndResolveTypeParameters

func (t StructType) ValidateAndResolveTypeParameters(values []TypeParameterValue, mode ProductMode) (*TypeParameters, error)

func (StructType) ValidateResolvedTypeParameters

func (t StructType) ValidateResolvedTypeParameters(params *TypeParameters, mode ProductMode) error

type TVFSignature

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

TVFSignature contains information about a specific resolved TVF call. It includes the input arguments passed into the TVF call and also its output schema (including whether it is a value table). Engines may also subclass this to include more information if needed.

type Table

type Table interface {
	Name() string
	FullName() string
	NumColumns() int
	Column(int) Column
	PrimaryKey() []int
	FindColumnByName(name string) Column
	IsValueTable() bool
	SerializationID() int64
	CreateEvaluatorTableIterator(columnIdxs []int) (*EvaluatorTableIterator, error)
	AnonymizationInfo() *AnonymizationInfo
	SupportsAnonymization() bool
	TableTypeName(mode ProductMode) string
}

type TableValuedFunction

type TableValuedFunction interface {
	Name() string
	FullName() string
	FunctionNamePath() []string
	NumSignatures() int64
	Signatures() []*FunctionSignature
	AddSignature(*FunctionSignature) error
	Signature(int64) *FunctionSignature
	SupportedSignaturesUserFacingText() string
	DebugString() string
	SetUserIdColumnNamePath(path []string) error
	AnonymizationInfo() *AnonymizationInfo
	// contains filtered or unexported methods
}

TableValuedFunction this interface describes a table-valued function (TVF) available in a query engine.

For reference, each call to the regular Function class:

  • accepts value (not relation) arguments only,
  • has a fixed list of (maybe templated) signatures and the function resolver selects one concrete signature,
  • returns a single value.

In contrast, each TVF call:

  • accepts scalar or relation arguments,
  • has a single signature specifying the types of input arguments,
  • returns a stream of rows,
  • has an output table schema (column names and types, or a value table) computed by a method in this class, and not described in the signature.

To resolve a TVF call, the resolver:

(1) gets the signature (currently, only one signature is supported) (2) resolves all input arguments as values or as relations based on the

signature

(3) prepares a TableValuedFunction.InputArgumentList from the resolved input

arguments

(4) calls TableValuedFunction.Resolve, passing the input arguments, to get

a TableValuedFunctionCall object with the output schema for the TVF call

(5) fills the output name list from the column names in the output schema (6) returns a TVFScanNode with the resolved arguments as children

type Type

type Type interface {
	Kind() TypeKind
	IsInt32() bool
	IsInt64() bool
	IsUint32() bool
	IsUint64() bool
	IsBool() bool
	IsFloat() bool
	IsDouble() bool
	IsString() bool
	IsBytes() bool
	IsDate() bool
	IsTimestamp() bool
	IsTime() bool
	IsDatetime() bool
	IsInterval() bool
	IsNumericType() bool
	IsBigNumericType() bool
	IsJsonType() bool
	IsFeatureV12CivilTimeType() bool
	UsingFeatureV12CivilTimeType() bool
	IsCivilDateOrTimeType() bool
	IsGeography() bool
	IsJson() bool
	IsEnum() bool
	IsArray() bool
	IsStruct() bool
	IsProto() bool
	IsStructOrProto() bool
	IsFloatingPoint() bool
	IsNumerical() bool
	IsInteger() bool
	IsInteger32() bool
	IsInteger64() bool
	IsSignedInteger() bool
	IsUnsignedInteger() bool
	IsSimpleType() bool
	IsExtendedType() bool
	AsArray() *ArrayType
	AsStruct() *StructType
	AsEnum() *EnumType
	SupportsGrouping() bool
	SupportsPartitioning() bool
	SupportsOrdering() bool
	SupportsEquality() bool
	Equals(Type) bool
	Equivalent(Type) bool
	ShortTypeName(ProductMode) string
	TypeName(ProductMode) string
	TypeNameWithParameters(*TypeParameters, ProductMode) (string, error)
	DebugString(details bool) string
	HasAnyFields() bool
	NestingDepth() int
	ValidateAndResolveTypeParameters(values []TypeParameterValue, mode ProductMode) (*TypeParameters, error)
	ValidateResolvedTypeParameters(params *TypeParameters, mode ProductMode) error
	// contains filtered or unexported methods
}

func BigNumericType

func BigNumericType() Type

func BoolType

func BoolType() Type

func BytesType

func BytesType() Type

func DateType

func DateType() Type

func DatetimeType

func DatetimeType() Type

func DoubleType

func DoubleType() Type

func EmptyStructType

func EmptyStructType() Type

func FloatType

func FloatType() Type

func GeographyType

func GeographyType() Type

func Int32Type

func Int32Type() Type

func Int64Type

func Int64Type() Type

func IntervalType

func IntervalType() Type

func JsonType

func JsonType() Type

func NumericType

func NumericType() Type

func StringType

func StringType() Type

func TimeType

func TimeType() Type

func TimestampType

func TimestampType() Type

func TypeFromKind

func TypeFromKind(kind TypeKind) Type

func TypeOf

func TypeOf(v interface{}) Type

func Uint32Type

func Uint32Type() Type

func Uint64Type

func Uint64Type() Type

type TypeKind

type TypeKind int

func (TypeKind) String

func (k TypeKind) String() string

type TypeList

type TypeList []Type

type TypeListView

type TypeListView = TypeList

type TypeParameterValue

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

type TypeParameters

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

type Value

type Value interface {
	// Type returns the type of the value.
	Type() Type

	// TypeKind returns the type kind of the value.
	TypeKind() TypeKind

	// PhysicalByteSize returns the estimated size of the in-memory C++ representation of this value.
	PhysicalByteSize() uint64

	// IsNull returns true if the value is null.
	IsNull() bool

	// IsEmptyArray returns true if the value is an empty array.
	IsEmptyArray() bool

	// IsValid returns true if the value is valid (invalid values are created by the default constructor).
	IsValid() bool

	// HasContent returns true if the Value is valid and non-null.
	HasContent() bool

	// Int32Value REQUIRES: int32 type
	Int32Value() int32

	// Int64Value REQUIRES: int64 type
	Int64Value() int64

	// Uint32Value REQUIRES: uint32 type
	Uint32Value() uint32

	// Uint64Value REQUIRES: uint64 type
	Uint64Value() uint64

	// BoolValue REQUIRES: bool type
	BoolValue() bool

	// FloatValue REQUIRES: float type
	FloatValue() float32

	// DoubleValue REQUIRES: double type
	DoubleValue() float64

	// StringValue REQUIRES: string type
	StringValue() string

	// BytesValue REQUIRES: bytes type
	BytesValue() []byte

	// DateValue REQUIRES: date type
	DateValue() int32

	// EnumValue REQUIRES: enum type
	EnumValue() int32

	// EnumName REQUIRES: enum type
	EnumName() string

	// ToTime REQUIRES: timestamp type
	ToTime() time.Time

	// ToUnixMicros returns timestamp value as Unix epoch microseconds. REQUIRES: timestamp type
	ToUnixMicros() int64

	// ToUnixNanos returns timestamp value as Unix epoch nanoseconds or an error if the value
	// does not fit into an int64. REQUIRES: timestamp type
	ToUnixNanos() (int64, error)

	// ToPacked64TimeMicros REQUIRES: time type.
	ToPacked64TimeMicros() int64

	// ToPacked64DatetimeMicros REQUIRES: datetime type.
	ToPacked64DatetimeMicros() int64

	// IsValidatedJSON checks whether the value belongs to the JSON type, non-NULL and is in
	// validated representation. JSON values can be in one of the two
	// representations:
	//  1) Validated: JSON is parsed, validated and transformed into an efficient
	//    (for field read/updates) in-memory representation (field tree) that can
	//    be accessed through json_value() method. ZetaSQL Analyzer uses this
	//    representation by default to represent JSON values (e.g. literals).
	//  2) Unparsed: string that was not validated and thus potentially can be
	//    an invalid JSON. ZetaSQL Analyzer uses this representation when
	//    LanguageFeature FEATURE_JSON_NO_VALIDATION is enabled.
	IsValidatedJSON() bool

	// IsUnparsedJSON returns true if the value belongs to the JSON type, non-null and is in
	// unparsed representation. See comments to IsValidatedJSON() for more details.
	IsUnparsedJSON() bool

	JSONValueUnparsed() string
	JSONString() string

	// ToInt64 for bool, int32, int64, date, enum
	ToInt64() int64

	// ToUint64 for bool, uint32, uint64
	ToUint64() uint64
	ToDouble() float64

	// NumFields struct-specific methods. REQUIRES: !IsNull().
	NumFields() int

	Field(int) Value
	Fields() []Value

	// FindFieldByName returns the value of the first field with the given 'name'.
	// If one doesn't exist, returns an invalid value.
	// Does not find anonymous fields (those with empty names).
	FindFieldByName(name string) Value

	// Empty array-specific methods. REQUIRES: !IsNull().
	Empty() bool
	NumElements() int
	Element(int) Value
	Elements() []Value

	// Equals returns true if 'this' equals 'that' or both are null. This is *not* SQL
	// equality which returns null when either value is null. Returns false if
	// 'this' and 'that' have different  For floating point values, returns
	// 'true' if both values are NaN of the same type.
	// For protos, returns true if the protos have the equivalent descriptors
	// (using Type::Equivalent) and the values are equivalent according to
	// MessageDifferencer::Equals, using the descriptor from 'this'.
	Equals(Value) bool

	// SQLEquals returns the BOOL (possibly NULL) Value of the SQL expression (*this =
	// that). Handles corner cases involving NULLs and NaNs. Returns an invalid
	// Value if the value types are not directly comparable (without an implicit
	// or explicit cast). (For example, INT64 and UINT64 are directly comparable,
	// but INT64 and INT32 are not comparable without a widening cast.) To be
	// safe, it is best to only use this method with Types that appear as
	// arguments to a call to the $equals function in a resolved AST generated by
	// the resolver.
	SQLEquals(Value) Value

	// LessThan when the types of 'this' and 'that' are compatible, this function returns
	// true when 'this' is smaller than 'that'. When the types of 'this' and
	// 'that' are not compatible, the behavior is undefined.
	//
	// For simple types, this uses '<' operator on native c++ types to compare the
	// values. A null value is less than any non-null value. This is
	// *not* SQL inequality. For floating point values, NaN sorts smaller than
	// any other value including negative infinity.
	// For struct types, this compares the fields of the STRUCT pairwise in
	// ordinal order, returns true as soon as LessThan returns true for a field.
	// For array types, this compares the arrays in lexicographical order.
	LessThan(Value) bool

	// SQLLessThan returns the BOOL (possibly NULL) Value of the SQL expression (*this <
	// that). Handles corner cases involving NULLs, NaNs. Returns an invalid Value
	// if the value types are not directly comparable (without an implicit or
	// explicit cast). (For example, INT64 and UINT64 are directly comparable, but
	// INT64 and INT32 are not comparable without a widening cast.) To be safe, it
	// is best to only use this method with Types that appear as arguments to a
	// call to a comparison function ($equals, $less, $less_or_equals, $greater,
	// or $greater_or_equals) in a resolved AST generated by the resolver.
	SQLLessThan(Value) Value

	// HashCode returns the hash code of a value.
	//
	// Result is not guaranteed stable across different runs of a program. It is
	// not cryptographically secure. It should not be used for distributed
	// coordination, security or storage which requires a stable computation.
	//
	// For more background see https://abseil.io/docs/cpp/guides/hash.
	HashCode() uint64

	// ShortDebugString returns printable string for this Value.
	// Verbose DebugStrings include the type name.
	ShortDebugString() string
	FullDebugString() string
	DebugString() string

	// Format returns a pretty-printed (e.g. wrapped) string for the value.
	// Suitable for printing in golden-tests and documentation.
	Format() string

	// SQL returns a SQL expression that produces this value.
	// This is not necessarily a literal since we don't have literal syntax
	// for all values.
	// This assumes that any types used in Value can be resolved using the name
	// returned from type->TypeName().  Returned type names are sensitive to
	// the SQL ProductMode (INTERNAL or EXTERNAL).
	//
	// Note: Arguably, GetSQL() and GetSQLLiteral() don't work quite right for
	// STRUCTs.  In particular, they do not preserve field names in the result
	// string.  For example, if you have a STRUCT value like
	// STRUCT<a INT64, b STRING>(1, 'a'), and call GetSQL(), the result will
	// be "(1, 'a')".  If we're only interested in the value itself and not the
	// original type (with named fields) then maybe that's ok.  Note that
	// GetSQLLiteral() is used in ZetaSQL's FORMAT() function implementation
	// (Format() in zetasql/public_functions/format.cc) so we cannot change
	// the output without breaking existing ZetaSQL function semantics.
	SQL(mode ProductMode) string

	// SQLLiteral returns a SQL expression that is compatible as a literal for this value.
	// This won't include CASTs except for non-finite floating point values, and
	// won't necessarily produce the exact same type when parsed on its own, but
	// it should be the closest SQL literal form for this value.  Returned type
	// names are sensitive to the SQL ProductMode (INTERNAL or EXTERNAL).
	SQLLiteral(mode ProductMode) string
	// contains filtered or unexported methods
}

func Int64

func Int64(v int64) Value

Jump to

Keyboard shortcuts

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