Skip to main content
DuckDB’s math and trigonometry functions, plus the handful of general-purpose scalars that don’t belong to any other category — conditional null-handling, UUID generation, and runtime utilities. All are free functions in better_duck_diesel::dsl::*.

Math and trigonometry

Double -> Double unless noted:
abs<T>(x) (generic, preserves the argument type), sqrt, cbrt, pow(base, exponent), exp, ln, log2, log10, ceil, floor, round, sign.
sin, cos, tan, asin, acos, atan, atan2(y, x), degrees, radians.
gcd(a: BigInt, b: BigInt) (→BigInt), lcm(a: BigInt, b: BigInt) (→BigInt), mod_(a, b) (#[sql_name = "mod"], →BigInt), xor(a, b) (→BigInt), bit_count(x: BigInt) (→DuckTinyInt).
greatest<T>(a, b) and least<T>(a, b) — generic over T, returning the same type.
mod_ is spelled with a trailing underscore in Rust and emits mod(...) via #[sql_name = "mod"]. abs, greatest, and least are generic so they preserve the argument’s numeric type rather than forcing Double.

Conditional / null-handling

Generic over T:

UUID generation

All return DuckUuid (see Type mapping): gen_random_uuid(), uuidv4(), uuidv7().

Utility

version() (→Text) returns the DuckDB version string; type_of<T>(x) (#[sql_name = "typeof"], →Text) returns the DuckDB type name of its argument.

See also

String functions

Text transforms, hashing, encoding.

Date & time functions

Temporal extraction and construction.

Aggregates

Statistical and bitwise aggregates.

Type mapping

What Double / BigInt / DuckUuid load as.