mirror of
https://github.com/lancedb/lancedb.git
synced 2026-11-27 04:53:59 +00:00
## Summary Fixes #3211 by exposing the shared Rust/DataFusion expression builder through Node bindings. Case-sensitive references such as `col("firstName")` can be composed and passed to `where()`, while SQL strings remain supported. The expression-object representation follows [the design requested on #3290](https://github.com/lancedb/lancedb/pull/3290#discussion_r3632371998). That earlier PR remains open; no claim is made that the issue was unclaimed or that maintainers have selected this implementation. ## Review corrections - Construct the named native struct correctly and parse casts through `arrow_schema::DataType`. - Preserve numeric values: use Int64 only for JavaScript safe integers; retain Float64 otherwise. Explicit `litInt` rejects unsupported numbers with a documented `RangeError`. - Correct test syntax/API calls and align SQL assertions with the shared dialect, including reserved and case-sensitive names. - Use typed, isolated temporary test tables with cleanup, and cover an actual large-number filter threshold. - Document the public methods and commit generated API documentation. Synced with current main `0bceaaf3` through a normal merge. The diff is limited to seven Node source/test/config files and eleven generated documentation files; no Rust core change. ## Validation [Linux validation run](https://github.com/Ganesh1729-ui/lancedb/actions/runs/38244794288) on Node 24 / Rust 1.97.0 with the repository's `ci` profile and `remote,lancedb/metrics-otel` features: - Rebuilt native addon, TypeScript build, Biome, Rust formatting and native Clippy pass. - Expression/query/Arrow/table suites: **1,129 passed**; expression suite repeated: **42 passed**. - Using the original JavaScript numeric dispatch with the rebuilt addon: **8 regressions fail, 2 controls pass**. - Strict TypeDoc generation passes. Final local typing/docs/lint checks pass; the PR source equals the validated source except for the separate validation workflow, which is excluded from this PR. Full provider/model/S3, other feature combinations and OS/Node matrices were not run in this follow-up. Upstream checks and maintainer review remain separate. ## AI assistance AI was used for implementation, review and testing. No prior human review is claimed.
3.5 KiB
3.5 KiB
@lancedb/lancedb • Docs
@lancedb/lancedb / Expr
Class: Expr
A SQL expression backed by the shared LanceDB expression builder.
Example
table.query().where(col("firstName").eq("Alice")).toArray();
Constructors
new Expr()
new Expr(inner): Expr
Parameters
- inner:
Expr
Returns
Properties
inner
inner: Expr;
Methods
add()
add(other): Expr
Add a value.
Parameters
- other:
ExprLike
Returns
and()
and(other): Expr
Combine two predicates with AND.
Parameters
- other:
Expr
Returns
cast()
cast(dataType): Expr
Cast to an Arrow data type, such as "Int64".
Parameters
- dataType:
string
Returns
contains()
contains(substr): Expr
Test whether a string contains a substring.
Parameters
- substr:
ExprLike
Returns
div()
div(other): Expr
Divide by a value.
Parameters
- other:
ExprLike
Returns
eq()
eq(other): Expr
Compare for equality.
Parameters
- other:
ExprLike
Returns
gt()
gt(other): Expr
Compare for greater than.
Parameters
- other:
ExprLike
Returns
gte()
gte(other): Expr
Compare for greater than or equal to.
Parameters
- other:
ExprLike
Returns
isIn()
isIn(values): Expr
Test membership in a list of values.
Parameters
- values:
ExprLike[]
Returns
lower()
lower(): Expr
Convert a string to lowercase.
Returns
lt()
lt(other): Expr
Compare for less than.
Parameters
- other:
ExprLike
Returns
lte()
lte(other): Expr
Compare for less than or equal to.
Parameters
- other:
ExprLike
Returns
mul()
mul(other): Expr
Multiply by a value.
Parameters
- other:
ExprLike
Returns
ne()
ne(other): Expr
Compare for inequality.
Parameters
- other:
ExprLike
Returns
not()
not(): Expr
Negate this predicate.
Returns
or()
or(other): Expr
Combine two predicates with OR.
Parameters
- other:
Expr
Returns
sub()
sub(other): Expr
Subtract a value.
Parameters
- other:
ExprLike
Returns
toSql()
toSql(): string
Serialize with the LanceDB SQL dialect, preserving column case.
Returns
string
upper()
upper(): Expr
Convert a string to uppercase.