mirror of
https://github.com/lancedb/lancedb.git
synced 2026-11-13 14:16:54 +00:00
A broad documentation pass across the areas LanceDB Enterprise and Embedded diverge on most: **Data Curation** -- GPU Function execution, Slurm scheduling (and what Slurm is, for readers new to it), blob late materialization as its own page, joins, aggregation/profiling, sampling, near-duplicate detection, chunking, distributed shuffle, and IVF-partition clustering. **Feature Engineering** -- computed columns and materialized views, restructured to lead with the Function-based path and show the SQL form side by side with Python throughout; a single Auto Refresh page instead of duplicating scheduling details on every refresh page; adaptive execution; checkpointing; GPU and Slurm placement for refresh workers; a Training Cache page for the PyTorch data loader's automatic cache benefit. **Security & Governance** -- an Audit Log reference (schema, access, grants), Secrets promoted to an ordinary catalog object with their own SQL DDL and a vending/rotation guide, and privilege-table fixes verified against the authorization source. **Deployment & Maintenance** -- Horizontal Scaling and OpenTelemetry moved into a real Deployment area; Automated Cleanup folded into Intelligent Auto-Maintenance (every other maintenance decision already lived there); RTE Compaction and Advanced Conflict Resolution documented in depth. **Landing page** -- the Enterprise feature comparison table reorganized (several redundant or stale rows removed, several new areas added), and the "why Enterprise" bullets replaced with ones tied to a concrete page (Performance, Scale, Fault tolerance, Multicloud deployment, Simplify operations) instead of vague promises. Plus a full pass addressing lancedb-gatekeeper's review: a real test-safety bug (a quickstart test could silently overwrite and delete a deployment's own `frames` table), a fabricated SQL statement with no backing implementation, an actual dedup-guarantee bug in `take_row_ids`, and dozens of documentation-accuracy fixes verified against source rather than taken on faith -- each either fixed, or left with an explicit note on why it needs a feature or deployment owner's sign-off instead of being guessed at. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_018PXMCbRH6i5w47TsjeEUMT --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
89 lines
3.0 KiB
Plaintext
89 lines
3.0 KiB
Plaintext
---
|
|
title: "Operators and literals"
|
|
sidebarTitle: "Operators"
|
|
description: "Comparison, logical and arithmetic operators, literals, and precedence."
|
|
icon: plus-minus
|
|
keywords: ["operators", "literals", "precedence", "null", "cast", "interval"]
|
|
availability:
|
|
embedded: unavailable
|
|
enterprise: available
|
|
---
|
|
|
|
LanceDB uses DataFusion's SQL operators. This page describes comparison,
|
|
logical and arithmetic operators, literal values, type conversions and
|
|
operator precedence.
|
|
|
|
## Comparison {#comparison}
|
|
|
|
| | |
|
|
| --- | --- |
|
|
| `=` `!=` `<>` `<` `<=` `>` `>=` | ordinary comparison |
|
|
| `IS NULL` / `IS NOT NULL` | null test (`= NULL` is never true) |
|
|
| `IS DISTINCT FROM` | comparison that treats null as a value |
|
|
| `BETWEEN a AND b` | inclusive range |
|
|
| `IN (...)` | set membership |
|
|
| `LIKE` / `ILIKE` | pattern match, `%` and `_` |
|
|
| `~` `~*` `!~` | regular expression match |
|
|
|
|
<Note>
|
|
For keyword matching on a text column, [`contains_tokens`](/sql/dql/contains-tokens)
|
|
is index-accelerated where `LIKE` is not. Reach for `LIKE` only when you need
|
|
its wildcard semantics.
|
|
</Note>
|
|
|
|
## Logical {#logical}
|
|
|
|
`AND`, `OR`, `NOT`. Three-valued: a comparison against null is **unknown**, and
|
|
`NOT unknown` is still unknown. A `WHERE` clause keeps only rows where the
|
|
predicate is true, so unknown behaves like false there, but not inside `NOT
|
|
IN`, which is the usual place this bites. See
|
|
[Subqueries](/sql/dql/subqueries#in-exists).
|
|
|
|
## Arithmetic {#arithmetic}
|
|
|
|
`+` `-` `*` `/` `%`, with the usual precedence. String concatenation is `||`.
|
|
|
|
<Warning>
|
|
Arithmetic over a vector column is **list** arithmetic, not scalar arithmetic:
|
|
a vector is a `FixedSizeList<Float32>`. When the operation you want is a
|
|
similarity comparison, use [vector search](/search/vector-search); whether SQL
|
|
can express it [depends on the Enterprise server version](/basics/sql#no-vector-sql).
|
|
</Warning>
|
|
|
|
## Literals {#literals}
|
|
|
|
| | |
|
|
| --- | --- |
|
|
| String | `'text'`, with a doubled quote to escape: `'it''s'` |
|
|
| Number | `42`, `3.14` |
|
|
| Boolean | `TRUE`, `FALSE` |
|
|
| Null | `NULL` |
|
|
| Date / timestamp | `DATE '2026-01-01'`, `TIMESTAMP '2026-01-01 12:00:00'` |
|
|
| Interval | `INTERVAL '7 days'` |
|
|
| Array | `[1, 2, 3]` |
|
|
|
|
Identifiers are quoted with double quotes when they need to be (a reserved word
|
|
or a name with mixed case): `SELECT "order" FROM "MyTable"`.
|
|
|
|
## Casting {#casting}
|
|
|
|
<CodeGroup>
|
|
```sql SQL icon="database"
|
|
SELECT CAST(identifier AS VARCHAR) AS with_cast, identifier::VARCHAR AS with_colons
|
|
FROM documents
|
|
```
|
|
</CodeGroup>
|
|
|
|
Both forms work. Give each its own alias when one projection uses both: they
|
|
produce the same expression name, and a projection refuses two columns with
|
|
one name. `TRY_CAST` returns null instead of erroring on a value that
|
|
will not convert, which is the one to use over a column you do not control.
|
|
|
|
## Precedence {#precedence}
|
|
|
|
Highest to lowest: `::` → unary `-` → `* / %` → `+ -` → `||` → comparison →
|
|
`IS` → `NOT` → `AND` → `OR`.
|
|
|
|
Parenthesize anything mixing `AND` and `OR`. `a OR b AND c` is `a OR (b AND c)`,
|
|
which is rarely what was meant.
|