Build functions in the Marisa DuckDB extension
Function category
Build
1 functionThe aggregate that turns a column of strings into a single MARISA trie BLOB. Build once at ingest time, store the BLOB in any column type, query repeatedly. Updates require a rebuild — there is no incremental insert.
Signature
marisa_trie(col0: VARCHAR) → BLOB
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
col0
|
Type
VARCHAR
|
Mode Positional | Description |
Description
Aggregate that builds a MARISA trie from a column of strings. Returns a single self-contained BLOB you can store in any column type, persist in Parquet, or ship to another DuckDB instance. The trie is static — to add or remove keys, rebuild from the updated source set.
1
Build a trie from a column at ingest time
CREATE TABLE employees_trie AS
SELECT marisa_trie(name) AS trie FROM employees;
2
One trie per logical partition (day, tenant, region)
CREATE TABLE name_tries AS
SELECT day,
marisa_trie(name) AS trie
FROM signups
GROUP BY day;
Related functions
- marisa_lookup() — Returns `BOOLEAN` — `true` iff the search string is in the trie
- marisa_predictive() — Returns `VARCHAR[]` — every string in the trie that **starts with** the given prefix, capped at `max_results`
- marisa_common_prefix() — Returns `VARCHAR[]` — every string in the trie that is **a prefix of** the search string, capped at `max_results`