mirror of
https://github.com/lancedb/lancedb.git
synced 2026-10-13 15:22:30 +00:00
docs: publish the Function pages only once Functions launch
The two Function pages declare `launch: functions`, and every other page marks what it says about Functions, so the assembled site leaves them out until the launch. Before it, the pages that offered Functions for Python work point Enterprise readers at Geneva instead. The SQL Function example now uses Arrow type names, which the server requires, and states the 3.12 default for `python_version`.
This commit is contained in:
@@ -4,6 +4,7 @@ sidebarTitle: "Function"
|
||||
description: "CREATE FUNCTION, SHOW FUNCTIONS, and DROP FUNCTION."
|
||||
icon: function
|
||||
keywords: ["create function", "drop function", "show functions", "sql", "udf"]
|
||||
launch: functions
|
||||
---
|
||||
|
||||
<Badge color="red">Enterprise</Badge> [SQL runs on a deployment.](/sql)
|
||||
@@ -11,12 +12,17 @@ keywords: ["create function", "drop function", "show functions", "sql", "udf"]
|
||||
## CREATE FUNCTION {#create}
|
||||
|
||||
```sql
|
||||
CREATE FUNCTION f(x BIGINT) RETURNS BIGINT
|
||||
CREATE FUNCTION f(x int64) RETURNS int64
|
||||
LANGUAGE python
|
||||
AS 'def f(x): return x * 2'
|
||||
WITH (pip = 'numpy==1.26.4', python_version = '3.11')
|
||||
```
|
||||
|
||||
Parameter and result types are Arrow type names, not SQL ones: `int64`,
|
||||
`float64`, `utf8`, `bool`, `date32`, and lists such as `list<float32>` or
|
||||
`fixed_size_list<float32, 768>`. `BIGINT` is refused. A parameter accepts nulls
|
||||
unless it is declared `NOT NULL`.
|
||||
|
||||
The body is Python source. Its dependencies are declared with it and are part
|
||||
of the **immutable function version** -- changing one produces a new version
|
||||
rather than altering the registered one, so a column filled by an earlier
|
||||
@@ -27,7 +33,7 @@ version is unaffected.
|
||||
| `pip` | pip requirements for the worker environment |
|
||||
| `conda` | conda packages instead of pip |
|
||||
| `conda_channels` | channels in priority order; requires `conda` |
|
||||
| `python_version` | worker Python version, defaulting to yours |
|
||||
| `python_version` | worker Python version; `3.12` when omitted, whatever Python you send the statement from |
|
||||
| `gpu` | `'true'` when every execution needs a GPU |
|
||||
|
||||
**Errors and limits**
|
||||
|
||||
@@ -36,7 +36,7 @@ DROP SCHEMA `a$b` RESTRICT
|
||||
|
||||
<Warning>
|
||||
`CASCADE` is rejected: **"DROP SCHEMA CASCADE is not supported; drop the
|
||||
objects inside first."** A namespace's tables, views and functions must be
|
||||
objects inside first."** A namespace's tables, views and other objects must be
|
||||
dropped explicitly before the namespace itself can go. `RESTRICT` -- the
|
||||
default -- states that requirement rather than changing it.
|
||||
</Warning>
|
||||
|
||||
@@ -30,8 +30,8 @@ The table's columns and types, without a plan -- the SQL counterpart of
|
||||
|
||||
## ALTER TABLE {#alter}
|
||||
|
||||
`ALTER TABLE ... ADD COLUMN` covers three different things, distinguished by
|
||||
what follows the column name.
|
||||
What `ALTER TABLE ... ADD COLUMN` does depends on what follows the column
|
||||
name.
|
||||
|
||||
### A plain column {#plain-column}
|
||||
|
||||
@@ -52,6 +52,7 @@ The column is committed empty and the expression is stored, not evaluated --
|
||||
declaring one on a billion-row table costs what declaring one on an empty table
|
||||
costs. [`REFRESH COLUMN`](/sql/dml/refresh) fills it.
|
||||
|
||||
{/* if functions launched */}
|
||||
### A function column {#function-column}
|
||||
|
||||
```sql
|
||||
@@ -86,6 +87,7 @@ ALTER TABLE t ADD COLUMN c AS f(x) WITH (num_workers = '2')
|
||||
`WITH` on a plain computed column accepts only `version`. Resource options such
|
||||
as `num_workers` apply to function columns, where there are workers to size.
|
||||
</Note>
|
||||
{/* end if */}
|
||||
|
||||
### Table properties {#properties}
|
||||
|
||||
|
||||
@@ -52,11 +52,13 @@ REFRESH COLUMN embedding ON documents
|
||||
`num_workers` sets a count; the budget options size each worker. They are
|
||||
alternatives rather than a pair.
|
||||
|
||||
{/* if functions launched */}
|
||||
<Note>
|
||||
`error_policy` and `num_workers` are refused for a column filled by a registered
|
||||
[function](/management/function) with its own resource budget -- use the CPU,
|
||||
memory and GPU options there.
|
||||
</Note>
|
||||
{/* end if */}
|
||||
|
||||
## REFRESH MATERIALIZED VIEW {#refresh-materialized-view}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ operations that have no SQL form, such as a merge insert -- see
|
||||
| [View](/sql/ddl/view) | `CREATE VIEW`, `DROP VIEW` |
|
||||
| [Materialized view](/sql/ddl/materialized-view) | `CREATE MATERIALIZED VIEW`, `SHOW MATERIALIZED VIEWS` |
|
||||
| [Index](/sql/ddl/index) | `CREATE INDEX`, `DROP INDEX` |
|
||||
| [Function](/sql/ddl/function) | `CREATE FUNCTION`, `SHOW FUNCTIONS`, `DROP FUNCTION` |
|
||||
| [Function](/sql/ddl/function) {/* if functions launched */} | `CREATE FUNCTION`, `SHOW FUNCTIONS`, `DROP FUNCTION` |
|
||||
| [Job](/sql/ddl/job) | `SHOW JOBS`, `SHOW ERRORS`, `PAUSE`/`RESUME`/`CANCEL JOB` |
|
||||
|
||||
### DML {#dml}
|
||||
|
||||
Reference in New Issue
Block a user