const AnyNotNull = "any_not_null"
AnyNotNull is the name of the aggregate returned by NewAnyNotNullAggregate.
const NodeIDBits = 15
NodeIDBits is the number of bits stored in the lower portion of GenerateUniqueInt.
var ( // DatEncodingUTFId is the encoding ID for our only supported database // encoding, UTF8. DatEncodingUTFId = tree.NewDInt(6) // DatEncodingEnUTF8 is the encoding name for our only supported database // encoding, UTF8. DatEncodingEnUTF8 = tree.NewDString("en_US.utf8") )
AllAggregateBuiltinNames is an array containing the subset of AllBuiltinNames that corresponds to aggregate functions.
AllBuiltinNames is an array containing all the built-in function names, sorted in alphabetical order. This can be used for a deterministic walk through the Builtins map.
AllWindowBuiltinNames is an array containing the subset of AllBuiltinNames that corresponds to window functions.
EvalFollowerReadOffset is a function used often with AS OF SYSTEM TIME queries to determine the appropriate offset from now which is likely to be safe for follower reads. It is injected by followerreadsccl. An error may be returned if an enterprise license is not installed.
var ( // SequenceNameArg represents the name of sequence (string) arguments in // builtin functions. SequenceNameArg = "sequence_name" )
CleanEncodingName sanitizes the string meant to represent a recognized encoding. This ignores any non-alphanumeric character.
See function clean_encoding_name() in postgres' sources in backend/utils/mb/encnames.c.
EmptyGenerator returns a new, empty generator. Used when a SRF evaluates to NULL.
GenerateUniqueID encapsulates the logic to generate a unique number from a nodeID and timestamp.
GenerateUniqueInt creates a unique int composed of the current time at a 10-microsecond granularity and the instance-id. The instance-id is stored in the lower 15 bits of the returned value and the timestamp is stored in the upper 48 bits. The top-bit is left empty so that negative values are not returned. The 48-bit timestamp field provides for 89 years of timestamps. We use a custom epoch (Jan 1, 2015) in order to utilize the entire timestamp range.
Note that GenerateUniqueInt() imposes a limit on instance IDs while generateUniqueBytes() does not.
TODO(pmattis): Do we have to worry about persisting the milliseconds value periodically to avoid the clock ever going backwards (e.g. due to NTP adjustment)?
GetBuiltinProperties provides low-level access to a built-in function's properties. For a better, semantic-rich interface consider using tree.FunctionDefinition instead, and resolve function names via ResolvableFunctionReference.Resolve().
func NewAggregateWindowFunc( aggConstructor func(*tree.EvalContext, tree.Datums) tree.AggregateFunc, ) func(*tree.EvalContext) tree.WindowFunc
NewAggregateWindowFunc creates a constructor of aggregateWindowFunc with agg initialized by provided aggConstructor.
NewAnyNotNullAggregate returns an aggregate function that returns an arbitrary not-NULL value passed to Add (or NULL if no such value). This is particularly useful for "passing through" values for columns which we know are constant within any aggregation group (for example, the grouping columns themselves).
Note that NULL values do not affect the result of the aggregation; this is important in a few different contexts:
- in distributed multi-stage aggregations, we can have a local stage with multiple (parallel) instances feeding into a final stage. If some of the instances see no rows, they emit a NULL into the final stage which needs to be ignored. - for query optimization, when moving aggregations across left joins (which add NULL values).
PGIOBuiltinPrefix returns the string prefix to a type's IO functions. This is either the type's postgres display name or the type's postgres display name plus an underscore, depending on the type.
ShouldReset sets shouldReset to true if w is framableAggregateWindowFunc.