--- title: "Functions" sidebarTitle: "Functions" description: "Where to find each kind of function, and the dialect version they come from." icon: function keywords: ["functions", "datafusion", "scalar", "aggregate", "window", "fts", "table function"] availability: embedded: unavailable enterprise: available --- LanceDB executes SQL with [Apache DataFusion](https://datafusion.apache.org), currently **version 54**. The function set is DataFusion's default registration plus what Lance adds. | | | | --- | --- | | [Scalar functions](/sql/dql/scalar-functions) | per row: math, string, regex, date/time, array, struct{/* Draft until JSON columns reach early access: restore ", JSON" */} | | [Aggregate functions](/sql/dql/aggregation#functions) | per group: `count`, `sum`, statistical, approximate | | [Window functions](/sql/dql/window#functions) | per window: ranking, offset, running aggregates | | [Table functions](#table-functions) | produce a relation rather than a value | Function availability is version-specific. DataFusion adds functions in most releases, so one documented on `main` may not exist in 54. When a name is not recognised, check it against the reference for that version before assuming a bug. ## Table functions {#table-functions} A table function appears in `FROM` and produces a relation, which is what lets it return columns a scalar function has nowhere to put. Each has its own reference page: | | | | --- | --- | | [`fts(table, query)`](/sql/dql/fts) | full-text search, with a relevance score alongside the matching rows | | [`dedupe(table, column, ...)`](/sql/dql/dedupe) | one representative row per near-duplicate group | | [`duplicate_pairs(table, column, ...)`](/sql/dql/duplicate-pairs) | every close pair, before resolving into groups | | [`generate_series(start, stop)`](/sql/dql/generate-series) | rows from a range | `_score`, the relevance pseudo-column `fts()` produces, is not a function; see [Data types](/sql/data-types#pseudo-columns). ## What Lance accelerates {#accelerated} `contains_tokens` uses an index rather than scanning, which is the difference between a fast predicate and a slow one: | | Index used | | --- | --- | | [`contains_tokens`](/sql/dql/contains-tokens) | full-text index | {/* Draft until JSON columns reach early access; restore "Two function families" above. | [`json_get`, typed variants, `json_extract`](/sql/dql/json-functions) | JSON scalar index | */} Confirm with [`EXPLAIN`](/sql/dql/explain): an accelerated predicate shows an index node rather than a `LanceScan` followed by a filter.