Expand description
SQL forms of the hash used by iceberg_hash partition rules.
iceberg_hash(col) is the same function partition rules evaluate, exposed so
that users can measure a distribution or verify which bucket a value falls
into. It must never diverge from the rule form: both are built from
partition::function::iceberg_hash_udf.
iceberg_hash_bounds(n) prints the breakpoints of an equal-width n-bucket
split, ready to paste into PARTITION ON COLUMNS. It only formats the
numbers; it does not create or change partitions.
iceberg_hash_breakpoints(v1, v2, ...) hashes the given constant values
(any order, all from one hash encoding: strings, or integers) and prints them
sorted, for building buckets around known key values instead of around equal
widths.
iceberg_hash_ranges_sql(column, n) renders the whole rule list for
PARTITION ON COLUMNS from an equal-width split, so it can be pasted
without expanding the breakpoints by hand. The column name is quoted, so
names that are not plain lowercase identifiers round-trip.
Structsยง
- Iceberg
Hash ๐Bounds Function iceberg_hash_bounds(n): then - 1equal-width breakpoints of the hash space, as comma separatedINT32literals.- Iceberg
Hash ๐Breakpoints Function iceberg_hash_breakpoints(v1, v2, ...): the sorted, comma separated hash values of the given constant values, asINT32literals.- Iceberg
Hash ๐Function iceberg_hash(col): registers the UDF partition rules already plan.- Iceberg
Hash ๐Ranges SqlFunction iceberg_hash_ranges_sql(column, n): the ready-to-paste rule list forPARTITION ON COLUMNS, built from an equal-widthn-bucket split.
Enumsยง
- Hash
Domain ๐ - The hash encoding a constant goes through. Integer widths share one
encoding (
INT32,UINT8, โฆ all hash as Iceberg longs), while strings use their UTF-8 bytes, so mixing the two produces breakpoints that do not describe a single column.
Constantsยง
- MAX_
BUCKETS ๐ iceberg_hash_boundshard limit. Each region carries its own WAL, memtable, manifest and compaction stream, so four-digit bucket counts are already far beyond any practical table.
Functionsยง
- equal_
split_ ๐breakpoints - Returns the
n - 1equal-width breakpoints ofbucketsoverINT32, followingbi = i32::MIN + floor(i * 2^32 / n). - into_
hashed_ ๐scalar - Hashes one constant by evaluating it through the shared array form, so the value goes through exactly the code a partition rule evaluates.
- quoted_
identifier ๐ - Quotes a column name as a SQL identifier: wrap it in double quotes and double every embedded quote.