Skip to content

本页尚未翻译

本页内容仍为英文原文,源自官方文档 sql/dql/functions。中文翻译正在分批进行中。

Functions ​

Where to find each kind of function, and the dialect version they come from.

Applies to: Embedded ❌, Enterprise ✅

LanceDB executes SQL with Apache DataFusion, currently version 54. The function set is DataFusion's default registration plus what Lance adds.

Scalar functionsper row: math, string, regex, date/time, array, struct
Aggregate functionsper group: count, sum, statistical, approximate
Window functionsper window: ranking, offset, running aggregates
Table functionsproduce 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 ​

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)full-text search, with a relevance score alongside the matching rows
dedupe(table, column, ...)one representative row per near-duplicate group
duplicate_pairs(table, column, ...)every close pair, before resolving into groups
generate_series(start, stop)rows from a range

_score, the relevance pseudo-column fts() produces, is not a function; see Data types.

What Lance accelerates ​

contains_tokens uses an index rather than scanning, which is the difference between a fast predicate and a slow one:

Index used
contains_tokensfull-text index

Confirm with EXPLAIN: an accelerated predicate shows an index node rather than a LanceScan followed by a filter.