Documentation
¶
Overview ¶
Package kernel implements the whole-column operations a transform plan runs. Each kernel reads its arguments as Arrow datums, leaves them for the caller to release, and returns a new datum the caller owns. A null in is a null out. The package depends on Arrow alone, so it can leave filament without change.
Names follow the yaml grammar: to_date is ToDate, year is Year, lower is Lower. Only conversions between types carry the To prefix.
Index ¶
- func Abs(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func Add(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func And(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func Ceil(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func Coalesce(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func Compare(op Op) func(context.Context, []compute.Datum) (compute.Datum, error)
- func CompareDecimalText(op Op) func(context.Context, []compute.Datum) (compute.Datum, error)
- func Concat(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func Day(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func Div(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func Floor(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func IfElse(ctx context.Context, mask *array.Boolean, then, els arrow.Array) (arrow.Array, error)
- func IsNull(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func Length(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func Lower(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func Md5(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func Month(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func Mul(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func Not(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func Or(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func RegexExtract(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func RegexMatch(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func RegexReplace(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func Replace(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func Round(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func Sha1(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func Sha256(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func Sha512(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func Sub(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func Substring(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func ToDate(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func Trim(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func Upper(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- func Year(ctx context.Context, args []compute.Datum) (compute.Datum, error)
- type Op
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Coalesce ¶
Coalesce takes, per row, the first argument that is not null. Arguments share one type; a literal is broadcast to the column length.
func Compare ¶ added in v0.29.0
Compare is Arrow's comparison for op. A null on either side compares to null.
func CompareDecimalText ¶ added in v0.29.0
CompareDecimalText is the comparison for decimals arrowbatch carries as utf8 rather than decimal128. Both sides are read as exact numbers, so "1.0" equals "1.00" and "10" is greater than "9". A null on either side compares to null. NaN is above every number and equal to itself, and Infinity and -Infinity sit at the ends, as PostgreSQL orders numeric.
func Concat ¶
Concat joins its arguments end to end for every row. Any argument may be a column or a literal; a null in any column part gives a null row.
func IfElse ¶
IfElse returns then where mask is true and els everywhere else, including where mask is null, which matches SQL CASE. then and els must share a type. utf8 has a direct path; every other type goes through concatenate and take.
func IsNull ¶
IsNull is true where the column has no value. It reads validity itself; the registry's is_null lacks a kernel for some column types, decimal among them.
func RegexExtract ¶
RegexExtract returns the first match of the pattern in each value, or the given capture group of it. A row with no match is null.
func RegexMatch ¶
RegexMatch reports, per row, whether a utf8 column matches the pattern.
func RegexReplace ¶
RegexReplace rewrites every match of the pattern in each value, expanding $1-style group references in the replacement.
func Replace ¶
Replace swaps every occurrence of find with with in every value of a utf8 column. Both are literals.
func Substring ¶
Substring slices every value of a utf8 column by character position, counting from 1 as SQL does. Without a length it runs to the end.
func ToDate ¶
ToDate parses every value of a utf8 column as an ISO date. A value that does not parse fails the whole batch rather than becoming null.