Documentation ¶
Index ¶
- Constants
- func EvaluateTypeExpression(nullHandling NullabilityHandling, expr parser.TypeExpression, ...) (types.Type, error)
- func HasSyncParams(params []types.FuncDefArgType) bool
- type AdvancedExtension
- type AggVariantOptions
- type AggregateFunction
- type AggregateFunctionImpl
- type AggregateFunctionVariant
- func (s *AggregateFunctionVariant) Args() ArgumentList
- func (s *AggregateFunctionVariant) CompoundName() string
- func (s *AggregateFunctionVariant) Decomposability() DecomposeType
- func (s *AggregateFunctionVariant) Description() string
- func (s *AggregateFunctionVariant) Deterministic() bool
- func (s *AggregateFunctionVariant) ID() ID
- func (s *AggregateFunctionVariant) Intermediate() (types.FuncDefArgType, error)
- func (s *AggregateFunctionVariant) Match(argumentTypes []types.Type) (bool, error)
- func (s *AggregateFunctionVariant) MatchAt(typ types.Type, pos int) (bool, error)
- func (s *AggregateFunctionVariant) MaxArgumentCount() int
- func (s *AggregateFunctionVariant) MaxSet() int
- func (s *AggregateFunctionVariant) MinArgumentCount() int
- func (s *AggregateFunctionVariant) Name() string
- func (s *AggregateFunctionVariant) Nullability() NullabilityHandling
- func (s *AggregateFunctionVariant) Options() map[string]Option
- func (s *AggregateFunctionVariant) Ordered() bool
- func (s *AggregateFunctionVariant) ResolveType(argumentTypes []types.Type) (types.Type, error)
- func (s *AggregateFunctionVariant) SessionDependent() bool
- func (s *AggregateFunctionVariant) URI() string
- func (s *AggregateFunctionVariant) Variadic() *VariadicBehavior
- type Argument
- type ArgumentList
- type Collection
- func (c *Collection) GetAggregateFunc(id ID) (*AggregateFunctionVariant, bool)
- func (c *Collection) GetAllAggregateFunctions() []*AggregateFunctionVariant
- func (c *Collection) GetAllScalarFunctions() []*ScalarFunctionVariant
- func (c *Collection) GetAllWindowFunctions() []*WindowFunctionVariant
- func (c *Collection) GetScalarFunc(id ID) (*ScalarFunctionVariant, bool)
- func (c *Collection) GetType(id ID) (t Type, ok bool)
- func (c *Collection) GetTypeVariation(id ID) (tv TypeVariation, ok bool)
- func (c *Collection) GetWindowFunc(id ID) (*WindowFunctionVariant, bool)
- func (c *Collection) Load(uri string, r io.Reader) error
- func (c *Collection) URILoaded(uri string) bool
- type DecomposeType
- type EnumArg
- type Function
- type FunctionVariant
- type ID
- type NullabilityHandling
- type Option
- type ParamType
- type ParameterConsistency
- type ScalarFunction
- type ScalarFunctionImpl
- type ScalarFunctionVariant
- func (s *ScalarFunctionVariant) Args() ArgumentList
- func (s *ScalarFunctionVariant) CompoundName() string
- func (s *ScalarFunctionVariant) Description() string
- func (s *ScalarFunctionVariant) Deterministic() bool
- func (s *ScalarFunctionVariant) ID() ID
- func (s *ScalarFunctionVariant) Match(argumentTypes []types.Type) (bool, error)
- func (s *ScalarFunctionVariant) MatchAt(typ types.Type, pos int) (bool, error)
- func (s *ScalarFunctionVariant) MaxArgumentCount() int
- func (s *ScalarFunctionVariant) MinArgumentCount() int
- func (s *ScalarFunctionVariant) Name() string
- func (s *ScalarFunctionVariant) Nullability() NullabilityHandling
- func (s *ScalarFunctionVariant) Options() map[string]Option
- func (s *ScalarFunctionVariant) ResolveType(argumentTypes []types.Type) (types.Type, error)
- func (s *ScalarFunctionVariant) SessionDependent() bool
- func (s *ScalarFunctionVariant) URI() string
- func (s *ScalarFunctionVariant) Variadic() *VariadicBehavior
- type Set
- type SimpleExtensionFile
- type TopLevel
- type Type
- type TypeArg
- type TypeDef
- type TypeParamDef
- type TypeVariation
- type TypeVariationFunctions
- type ValueArg
- type VariadicBehavior
- type WindowFunction
- type WindowFunctionImpl
- type WindowFunctionVariant
- func (s *WindowFunctionVariant) Args() ArgumentList
- func (s *WindowFunctionVariant) CompoundName() string
- func (s *WindowFunctionVariant) Decomposability() DecomposeType
- func (s *WindowFunctionVariant) Description() string
- func (s *WindowFunctionVariant) Deterministic() bool
- func (s *WindowFunctionVariant) ID() ID
- func (s *WindowFunctionVariant) Intermediate() (types.FuncDefArgType, error)
- func (s *WindowFunctionVariant) Match(argumentTypes []types.Type) (bool, error)
- func (s *WindowFunctionVariant) MatchAt(typ types.Type, pos int) (bool, error)
- func (s *WindowFunctionVariant) MaxArgumentCount() int
- func (s *WindowFunctionVariant) MaxSet() int
- func (s *WindowFunctionVariant) MinArgumentCount() int
- func (s *WindowFunctionVariant) Name() string
- func (s *WindowFunctionVariant) Nullability() NullabilityHandling
- func (s *WindowFunctionVariant) Options() map[string]Option
- func (s *WindowFunctionVariant) Ordered() bool
- func (s *WindowFunctionVariant) ResolveType(argumentTypes []types.Type) (types.Type, error)
- func (s *WindowFunctionVariant) SessionDependent() bool
- func (s *WindowFunctionVariant) URI() string
- func (s *WindowFunctionVariant) Variadic() *VariadicBehavior
- func (s *WindowFunctionVariant) WindowType() WindowType
- type WindowType
- type WindowVariantOpts
Constants ¶
const SubstraitDefaultURIPrefix = "https://github.com/substrait-io/substrait/blob/main/extensions/"
Variables ¶
This section is empty.
Functions ¶
func EvaluateTypeExpression ¶
func EvaluateTypeExpression(nullHandling NullabilityHandling, expr parser.TypeExpression, paramTypeList ArgumentList, variadic *VariadicBehavior, actualTypes []types.Type) (types.Type, error)
func HasSyncParams ¶ added in v1.0.0
func HasSyncParams(params []types.FuncDefArgType) bool
HasSyncParams This API returns if params share a leaf param name
Types ¶
type AdvancedExtension ¶
type AdvancedExtension = extensions.AdvancedExtension
type AggVariantOptions ¶
type AggVariantOptions struct { Variadic *VariadicBehavior SessionDependant bool Deterministic bool Ordered bool // value of 0 == unlimited MaxSet uint Decomposable DecomposeType // should be a type expression // must not be empty if decomposable is not DecomposeNone IntermediateOutputType string }
type AggregateFunction ¶
type AggregateFunction struct { Name string Description string Impls []AggregateFunctionImpl }
func (*AggregateFunction) GetVariants ¶
func (s *AggregateFunction) GetVariants(uri string) []*AggregateFunctionVariant
func (*AggregateFunction) ResolveURI ¶
func (s *AggregateFunction) ResolveURI(uri string) []FunctionVariant
type AggregateFunctionImpl ¶
type AggregateFunctionImpl struct { ScalarFunctionImpl `yaml:",inline"` Intermediate parser.TypeExpression Ordered bool MaxSet int Decomposable DecomposeType }
type AggregateFunctionVariant ¶
type AggregateFunctionVariant struct {
// contains filtered or unexported fields
}
func NewAggFuncVariant ¶
func NewAggFuncVariant(id ID) *AggregateFunctionVariant
NewAggFuncVariant constructs a variant with the provided name and uri and uses the defaults for everything else.
Return expressions aren't included here as using this variant to construct an expression requires an output type argument. This is for creating an on-the-fly function variant that will not be registered as an extension.
func NewAggFuncVariantOpts ¶
func NewAggFuncVariantOpts(id ID, opts AggVariantOptions) *AggregateFunctionVariant
func (*AggregateFunctionVariant) Args ¶
func (s *AggregateFunctionVariant) Args() ArgumentList
func (*AggregateFunctionVariant) CompoundName ¶
func (s *AggregateFunctionVariant) CompoundName() string
func (*AggregateFunctionVariant) Decomposability ¶
func (s *AggregateFunctionVariant) Decomposability() DecomposeType
func (*AggregateFunctionVariant) Description ¶
func (s *AggregateFunctionVariant) Description() string
func (*AggregateFunctionVariant) Deterministic ¶
func (s *AggregateFunctionVariant) Deterministic() bool
func (*AggregateFunctionVariant) ID ¶ added in v0.4.2
func (s *AggregateFunctionVariant) ID() ID
func (*AggregateFunctionVariant) Intermediate ¶
func (s *AggregateFunctionVariant) Intermediate() (types.FuncDefArgType, error)
func (*AggregateFunctionVariant) Match ¶ added in v1.0.0
func (s *AggregateFunctionVariant) Match(argumentTypes []types.Type) (bool, error)
func (*AggregateFunctionVariant) MaxArgumentCount ¶ added in v1.1.0
func (s *AggregateFunctionVariant) MaxArgumentCount() int
func (*AggregateFunctionVariant) MaxSet ¶
func (s *AggregateFunctionVariant) MaxSet() int
func (*AggregateFunctionVariant) MinArgumentCount ¶ added in v1.1.0
func (s *AggregateFunctionVariant) MinArgumentCount() int
func (*AggregateFunctionVariant) Name ¶
func (s *AggregateFunctionVariant) Name() string
func (*AggregateFunctionVariant) Nullability ¶
func (s *AggregateFunctionVariant) Nullability() NullabilityHandling
func (*AggregateFunctionVariant) Options ¶
func (s *AggregateFunctionVariant) Options() map[string]Option
func (*AggregateFunctionVariant) Ordered ¶
func (s *AggregateFunctionVariant) Ordered() bool
func (*AggregateFunctionVariant) ResolveType ¶
func (*AggregateFunctionVariant) SessionDependent ¶
func (s *AggregateFunctionVariant) SessionDependent() bool
func (*AggregateFunctionVariant) URI ¶
func (s *AggregateFunctionVariant) URI() string
func (*AggregateFunctionVariant) Variadic ¶
func (s *AggregateFunctionVariant) Variadic() *VariadicBehavior
type ArgumentList ¶
type ArgumentList []Argument
func (*ArgumentList) UnmarshalYAML ¶
func (a *ArgumentList) UnmarshalYAML(fn func(interface{}) error) error
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
var DefaultCollection Collection
DefaultCollection is loaded with the default Substrait extension definitions. Parser needs to enhanced until than below function files are not processed 1. functions_arithmetic_decimal.yaml (need to parse complex return type) 2. functions_geometry.yaml (need to parse geometry type) 3. type_variations.yaml 4. unknown.yaml
func (*Collection) GetAggregateFunc ¶
func (c *Collection) GetAggregateFunc(id ID) (*AggregateFunctionVariant, bool)
func (*Collection) GetAllAggregateFunctions ¶ added in v0.7.0
func (c *Collection) GetAllAggregateFunctions() []*AggregateFunctionVariant
func (*Collection) GetAllScalarFunctions ¶ added in v0.7.0
func (c *Collection) GetAllScalarFunctions() []*ScalarFunctionVariant
func (*Collection) GetAllWindowFunctions ¶ added in v0.7.0
func (c *Collection) GetAllWindowFunctions() []*WindowFunctionVariant
func (*Collection) GetScalarFunc ¶
func (c *Collection) GetScalarFunc(id ID) (*ScalarFunctionVariant, bool)
func (*Collection) GetTypeVariation ¶
func (c *Collection) GetTypeVariation(id ID) (tv TypeVariation, ok bool)
func (*Collection) GetWindowFunc ¶
func (c *Collection) GetWindowFunc(id ID) (*WindowFunctionVariant, bool)
func (*Collection) URILoaded ¶
func (c *Collection) URILoaded(uri string) bool
type DecomposeType ¶
type DecomposeType string
const ( DecomposeNone DecomposeType = "NONE" DecomposeOne DecomposeType = "ONE" DecomposeMany DecomposeType = "MANY" )
type Function ¶
type Function interface {
ResolveURI(uri string) []FunctionVariant
}
type FunctionVariant ¶
type FunctionVariant interface { Name() string CompoundName() string Description() string Args() ArgumentList Options() map[string]Option URI() string ResolveType(argTypes []types.Type) (types.Type, error) Variadic() *VariadicBehavior // Match this function matches input arguments against this functions parameter list // returns (true, nil) if all input argument can type replace the function definition argument // returns (false, err) for invalid input argument. For e.g. if input argument nullability is not correctly // set this function will return error // returns (false, nil) valid input arguments and argument list type replace parameter list Match(argumentTypes []types.Type) (bool, error) // MatchAt this function matches input argument at position against definition of this // functions argument at same position // returns (true, nil) if input argument can type replace the function definition argument // returns (false, err) for invalid input argument. For e.g. if input arg position is negative or // argument nullability is not correctly set this function will return error // returns (false, nil) valid input argument type and argument can't type replace parameter at argPos MatchAt(typ types.Type, pos int) (bool, error) // MinArgumentCount returns minimum number of arguments required for this function MinArgumentCount() int // MaxArgumentCount returns minimum number of arguments accepted by this function MaxArgumentCount() int }
type ID ¶
type ID struct { URI string // Name of the object. For functions, a simple name may be used for lookups, // but as a unique identifier the compound name will be used Name string }
ID is the unique identifier for a substrait object
type NullabilityHandling ¶
type NullabilityHandling string
const ( MirrorNullability NullabilityHandling = "MIRROR" DeclaredOutputNullability NullabilityHandling = "DECLARED_OUTPUT" DiscreteNullability NullabilityHandling = "DISCRETE" )
type ParameterConsistency ¶
type ParameterConsistency string
const ( ConsistentParams ParameterConsistency = "CONSISTENT" InconsistentParams ParameterConsistency = "INCONSISTENT" )
type ScalarFunction ¶
type ScalarFunction struct { Name string `yaml:",omitempty"` Description string `yaml:",omitempty,flow"` Impls []ScalarFunctionImpl `yaml:",omitempty"` }
func (*ScalarFunction) GetVariants ¶
func (s *ScalarFunction) GetVariants(uri string) []*ScalarFunctionVariant
func (*ScalarFunction) ResolveURI ¶
func (s *ScalarFunction) ResolveURI(uri string) []FunctionVariant
type ScalarFunctionImpl ¶
type ScalarFunctionImpl struct { Args ArgumentList `yaml:",omitempty"` Options map[string]Option `yaml:",omitempty"` Variadic *VariadicBehavior `yaml:",omitempty"` SessionDependent bool `yaml:"sessionDependent,omitempty"` Deterministic bool `yaml:",omitempty"` Nullability NullabilityHandling `yaml:",omitempty" default:"MIRROR"` Return parser.TypeExpression `yaml:",omitempty"` Implementation map[string]string `yaml:",omitempty"` }
type ScalarFunctionVariant ¶
type ScalarFunctionVariant struct {
// contains filtered or unexported fields
}
func NewScalarFuncVariant ¶
func NewScalarFuncVariant(id ID) *ScalarFunctionVariant
NewScalarFuncVariant constructs a variant with the provided name and uri and uses the defaults for everything else.
Return expressions aren't included here as using this variant to construct an expression requires an output type argument. This is for creating an on-the-fly function variant that will not be registered as an extension.
func NewScalarFuncVariantWithProps ¶
func NewScalarFuncVariantWithProps(id ID, variadic *VariadicBehavior, sessionDependant, deterministic bool) *ScalarFunctionVariant
NewScalarFuncVariantWithProps is the same as NewScalarFuncVariant but allows setting the values for the SessionDependant, Variadic Behavior and Deterministic properties.
func (*ScalarFunctionVariant) Args ¶
func (s *ScalarFunctionVariant) Args() ArgumentList
func (*ScalarFunctionVariant) CompoundName ¶
func (s *ScalarFunctionVariant) CompoundName() string
func (*ScalarFunctionVariant) Description ¶
func (s *ScalarFunctionVariant) Description() string
func (*ScalarFunctionVariant) Deterministic ¶
func (s *ScalarFunctionVariant) Deterministic() bool
func (*ScalarFunctionVariant) ID ¶ added in v0.4.2
func (s *ScalarFunctionVariant) ID() ID
func (*ScalarFunctionVariant) Match ¶ added in v1.0.0
func (s *ScalarFunctionVariant) Match(argumentTypes []types.Type) (bool, error)
func (*ScalarFunctionVariant) MaxArgumentCount ¶ added in v1.1.0
func (s *ScalarFunctionVariant) MaxArgumentCount() int
func (*ScalarFunctionVariant) MinArgumentCount ¶ added in v1.1.0
func (s *ScalarFunctionVariant) MinArgumentCount() int
func (*ScalarFunctionVariant) Name ¶
func (s *ScalarFunctionVariant) Name() string
func (*ScalarFunctionVariant) Nullability ¶
func (s *ScalarFunctionVariant) Nullability() NullabilityHandling
func (*ScalarFunctionVariant) Options ¶
func (s *ScalarFunctionVariant) Options() map[string]Option
func (*ScalarFunctionVariant) ResolveType ¶
func (*ScalarFunctionVariant) SessionDependent ¶
func (s *ScalarFunctionVariant) SessionDependent() bool
func (*ScalarFunctionVariant) URI ¶
func (s *ScalarFunctionVariant) URI() string
func (*ScalarFunctionVariant) Variadic ¶
func (s *ScalarFunctionVariant) Variadic() *VariadicBehavior
type Set ¶
type Set interface { DecodeTypeVariation(anchor uint32) (ID, bool) DecodeFunc(anchor uint32) (ID, bool) DecodeType(anchor uint32) (ID, bool) LookupTypeVariation(anchor uint32, c *Collection) (TypeVariation, bool) LookupType(anchor uint32, c *Collection) (Type, bool) LookupScalarFunction(anchor uint32, c *Collection) (*ScalarFunctionVariant, bool) LookupAggregateFunction(anchor uint32, c *Collection) (*AggregateFunctionVariant, bool) LookupWindowFunction(anchor uint32, c *Collection) (*WindowFunctionVariant, bool) FindURI(uri string) (uint32, bool) GetTypeAnchor(id ID) uint32 GetFuncAnchor(id ID) uint32 GetTypeVariationAnchor(id ID) uint32 ToProto() ([]*extensions.SimpleExtensionURI, []*extensions.SimpleExtensionDeclaration) }
func GetExtensionSet ¶
type SimpleExtensionFile ¶
type SimpleExtensionFile struct { Types []Type `yaml:"types,omitempty"` TypeVariations []TypeVariation `yaml:"type_variations,omitempty"` ScalarFunctions []ScalarFunction `yaml:"scalar_functions,omitempty"` AggregateFunctions []AggregateFunction `yaml:"aggregate_functions,omitempty"` WindowFunctions []WindowFunction `yaml:"window_functions,omitempty"` }
type TopLevel ¶
type TopLevel interface { GetExtensionUris() []*extensions.SimpleExtensionURI GetExtensions() []*extensions.SimpleExtensionDeclaration }
type Type ¶
type Type struct { Name string Variadic bool Structure TypeDef `yaml:",omitempty"` Parameters []TypeParamDef }
type TypeParamDef ¶
type TypeVariation ¶
type TypeVariation struct { Name string Parent parser.TypeExpression Description string Functions TypeVariationFunctions }
type TypeVariationFunctions ¶
type TypeVariationFunctions string
const ( TypeVariationInheritsFuncs TypeVariationFunctions = "INHERITS" TypeVariationSeparateFuncs TypeVariationFunctions = "SEPARATE" )
type ValueArg ¶
type ValueArg struct { Name string `yaml:",omitempty"` Description string `yaml:",omitempty"` Value *parser.TypeExpression Constant bool `yaml:",omitempty"` }
type VariadicBehavior ¶
type VariadicBehavior struct { Min int `yaml:",omitempty"` Max int `yaml:",omitempty"` ParameterConsistency ParameterConsistency `yaml:"parameterConsistency,omitempty" default:"CONSISTENT"` }
func (*VariadicBehavior) IsValidArgumentCount ¶ added in v0.7.0
func (v *VariadicBehavior) IsValidArgumentCount(count int) bool
type WindowFunction ¶
type WindowFunction struct { Name string Description string Impls []WindowFunctionImpl }
func (*WindowFunction) GetVariants ¶
func (s *WindowFunction) GetVariants(uri string) []*WindowFunctionVariant
func (*WindowFunction) ResolveURI ¶
func (s *WindowFunction) ResolveURI(uri string) []FunctionVariant
type WindowFunctionImpl ¶
type WindowFunctionImpl struct { AggregateFunctionImpl `yaml:",inline"` WindowType WindowType `yaml:"window_type"` }
type WindowFunctionVariant ¶
type WindowFunctionVariant struct {
// contains filtered or unexported fields
}
func NewWindowFuncVariant ¶
func NewWindowFuncVariant(id ID) *WindowFunctionVariant
func NewWindowFuncVariantOpts ¶
func NewWindowFuncVariantOpts(id ID, opts WindowVariantOpts) *WindowFunctionVariant
func (*WindowFunctionVariant) Args ¶
func (s *WindowFunctionVariant) Args() ArgumentList
func (*WindowFunctionVariant) CompoundName ¶
func (s *WindowFunctionVariant) CompoundName() string
func (*WindowFunctionVariant) Decomposability ¶
func (s *WindowFunctionVariant) Decomposability() DecomposeType
func (*WindowFunctionVariant) Description ¶
func (s *WindowFunctionVariant) Description() string
func (*WindowFunctionVariant) Deterministic ¶
func (s *WindowFunctionVariant) Deterministic() bool
func (*WindowFunctionVariant) ID ¶ added in v0.4.2
func (s *WindowFunctionVariant) ID() ID
func (*WindowFunctionVariant) Intermediate ¶
func (s *WindowFunctionVariant) Intermediate() (types.FuncDefArgType, error)
func (*WindowFunctionVariant) Match ¶ added in v1.0.0
func (s *WindowFunctionVariant) Match(argumentTypes []types.Type) (bool, error)
func (*WindowFunctionVariant) MaxArgumentCount ¶ added in v1.1.0
func (s *WindowFunctionVariant) MaxArgumentCount() int
func (*WindowFunctionVariant) MaxSet ¶
func (s *WindowFunctionVariant) MaxSet() int
func (*WindowFunctionVariant) MinArgumentCount ¶ added in v1.1.0
func (s *WindowFunctionVariant) MinArgumentCount() int
func (*WindowFunctionVariant) Name ¶
func (s *WindowFunctionVariant) Name() string
func (*WindowFunctionVariant) Nullability ¶
func (s *WindowFunctionVariant) Nullability() NullabilityHandling
func (*WindowFunctionVariant) Options ¶
func (s *WindowFunctionVariant) Options() map[string]Option
func (*WindowFunctionVariant) Ordered ¶
func (s *WindowFunctionVariant) Ordered() bool
func (*WindowFunctionVariant) ResolveType ¶
func (*WindowFunctionVariant) SessionDependent ¶
func (s *WindowFunctionVariant) SessionDependent() bool
func (*WindowFunctionVariant) URI ¶
func (s *WindowFunctionVariant) URI() string
func (*WindowFunctionVariant) Variadic ¶
func (s *WindowFunctionVariant) Variadic() *VariadicBehavior
func (*WindowFunctionVariant) WindowType ¶
func (s *WindowFunctionVariant) WindowType() WindowType
type WindowType ¶
type WindowType string
const ( StreamingWindow WindowType = "STREAMING" PartitionWindow WindowType = "PARTITION" )
type WindowVariantOpts ¶
type WindowVariantOpts struct { Variadic *VariadicBehavior SessionDependant bool Deterministic bool Ordered bool // value of 0 == unlimited MaxSet uint Decomposable DecomposeType // should be a type expression // must not be empty if decomposable is not DecomposeNone IntermediateOutputType string WindowType WindowType }