Aggregates Aggregate

lttb()

Downsamples the (x, y) points to (at most) n representative points using the Largest Triangle Three Buckets algorithm. Returns a LIST of STRUCT(x, y); the points must be ordered by x (use lttb(x, y, n ORDER BY x)).

Reference: Haybarn WASM 2.0.0-rc12

Arguments & returns

16 overloads

lttb(x, y, n)

Aggregate
Overload link xyn Returns
#01 DOUBLEDOUBLEBIGINT STRUCT(x DOUBLE, y DOUBLE)[]
#02 DOUBLEFLOATBIGINT STRUCT(x DOUBLE, y FLOAT)[]
#03 FLOATDOUBLEBIGINT STRUCT(x FLOAT, y DOUBLE)[]
#04 FLOATFLOATBIGINT STRUCT(x FLOAT, y FLOAT)[]
#05 TIMESTAMP WITH TIME ZONEDOUBLEBIGINT STRUCT(x TIMESTAMP WITH TIME ZONE, y DOUBLE)[]
#06 TIMESTAMP WITH TIME ZONEFLOATBIGINT STRUCT(x TIMESTAMP WITH TIME ZONE, y FLOAT)[]
#07 TIMESTAMP_MSDOUBLEBIGINT STRUCT(x TIMESTAMP_MS, y DOUBLE)[]
#08 TIMESTAMP_MSFLOATBIGINT STRUCT(x TIMESTAMP_MS, y FLOAT)[]
#09 TIMESTAMP_NSDOUBLEBIGINT STRUCT(x TIMESTAMP_NS, y DOUBLE)[]
#10 TIMESTAMP_NSFLOATBIGINT STRUCT(x TIMESTAMP_NS, y FLOAT)[]
#11 TIMESTAMP_SDOUBLEBIGINT STRUCT(x TIMESTAMP_S, y DOUBLE)[]
#12 TIMESTAMP_SFLOATBIGINT STRUCT(x TIMESTAMP_S, y FLOAT)[]
#13 TIMESTAMPDOUBLEBIGINT STRUCT(x TIMESTAMP, y DOUBLE)[]
#14 TIMESTAMPFLOATBIGINT STRUCT(x TIMESTAMP, y FLOAT)[]
#15 TIMESTAMPTZ_NSDOUBLEBIGINT STRUCT(x TIMESTAMPTZ_NS, y DOUBLE)[]
#16 TIMESTAMPTZ_NSFLOATBIGINT STRUCT(x TIMESTAMPTZ_NS, y FLOAT)[]

Example

lttb example
SQL
Haybarn WASM 2.0.0-rc12 ยท In your browser

Engine example with sample data ยท Run to view results.