tomz-alt commented on code in PR #3564:
URL: https://github.com/apache/doris-website/pull/3564#discussion_r3122069135
##########
docs/lakehouse/file-formats/lance.md:
##########
@@ -0,0 +1,99 @@
+---
+{
+ "title": "Lance | File Formats",
+ "language": "en",
+ "description": "This document introduces the support for reading Lance
file formats in Doris.",
+ "sidebar_label": "Lance"
+}
+---
+
+# Lance
+
+:::tip
+Lance format support is an **experimental feature** available since Apache
Doris **5.0.0**.
+:::
+
+[Lance](https://lancedb.github.io/lance/) is a modern columnar data format
designed for AI/ML workloads, with native support for vector search, multimodal
data (images, embeddings), and fast random access.
+
+Doris supports reading Lance format files through Table Valued Functions (TVF).
+
+## Supported Features
+
+| Feature | Support |
+|---------|---------|
+| Reading data via Table Valued Function (`s3`, `local`) | Yes |
+| Automatic schema inference | Yes |
+| Column projection | Yes |
+| `WHERE` filter, `LIMIT`, `COUNT(*)`, aggregation | Yes |
+| Multi-fragment datasets | Yes |
+| Reading from Catalog | Not supported |
+| Writing data (Outfile/Export/INSERT INTO TVF) | Not supported |
+| Vector ANN search / Full-text search pushdown | Not supported |
+| Doris Data Cache integration | Not supported |
+
+## Dataset Layout
+
+A Lance dataset is a **directory** with the following typical structure:
+
+```
+my_dataset.lance/
+├── _transactions/
+├── _versions/
+└── data/
+ ├── fragment-0.lance
+ ├── fragment-1.lance
+ └── ...
+```
+
+When querying via TVF, the `uri` / `file_path` must point to a single `.lance`
data file inside the `data/` subdirectory of the dataset. Doris automatically
resolves the dataset root from this path and reads all fragments belonging to
the dataset.
+
+## Usage Examples
+
+### Read from S3
+
+```sql
+SELECT * FROM s3(
+ "uri" = "s3://bucket/path/to/my_dataset.lance/data/fragment.lance",
+ "format" = "lance",
+ "s3.access_key" = "ak",
+ "s3.secret_key" = "sk",
+ "s3.region" = "us-east-1",
+ "s3.endpoint" = "https://s3.us-east-1.amazonaws.com"
+) ORDER BY id LIMIT 10;
+```
+
+### Read from Local Disk
+
+```sql
+-- Get backend_id via: SHOW BACKENDS;
+SELECT * FROM local(
+ "file_path" = "data/my_dataset.lance/data/fragment.lance",
+ "backend_id" = "<backend_id>",
+ "format" = "lance"
+) ORDER BY id LIMIT 10;
+```
+
+### Aggregation over a Multi-Fragment Dataset
+
+```sql
+SELECT count(*), min(id), max(id) FROM s3(
+ "uri" = "s3://bucket/path/to/large.lance/data/fragment.lance",
+ "format" = "lance",
+ "s3.access_key" = "ak",
+ "s3.secret_key" = "sk",
+ "s3.region" = "us-east-1",
+ "s3.endpoint" = "https://s3.us-east-1.amazonaws.com"
+);
+```
+
+## Limitations
+
+- **TVF only**: Only the `s3` and `local` TVFs are supported. `CREATE CATALOG`
is not supported yet.
+- **Single data file per glob**: The `file_path` / `uri` must match exactly
one `.lance` data file per dataset. If a glob matches multiple `.lance` files
within the same multi-fragment dataset, each scan range will reopen the full
dataset and produce duplicate rows.
Review Comment:
The merged code (be/src/format/lance/lance_rust_reader.cpp:89-108) already
extracts fragment_file from the scan-range path and passes it to the Rust side,
which filters to exactly that
fragment. Glob-matching multiple .lance files in a multi-fragment dataset
works correctly — no duplication. I verified this end-to-end locally:
multi.lance/data/*.lance returned 15 rows
(correct), not 45.
##########
docs/lakehouse/file-formats/lance.md:
##########
@@ -0,0 +1,99 @@
+---
+{
+ "title": "Lance | File Formats",
+ "language": "en",
+ "description": "This document introduces the support for reading Lance
file formats in Doris.",
+ "sidebar_label": "Lance"
+}
+---
+
+# Lance
+
+:::tip
+Lance format support is an **experimental feature** available since Apache
Doris **5.0.0**.
+:::
+
+[Lance](https://lancedb.github.io/lance/) is a modern columnar data format
designed for AI/ML workloads, with native support for vector search, multimodal
data (images, embeddings), and fast random access.
+
+Doris supports reading Lance format files through Table Valued Functions (TVF).
+
+## Supported Features
+
+| Feature | Support |
+|---------|---------|
+| Reading data via Table Valued Function (`s3`, `local`) | Yes |
+| Automatic schema inference | Yes |
+| Column projection | Yes |
+| `WHERE` filter, `LIMIT`, `COUNT(*)`, aggregation | Yes |
+| Multi-fragment datasets | Yes |
+| Reading from Catalog | Not supported |
+| Writing data (Outfile/Export/INSERT INTO TVF) | Not supported |
+| Vector ANN search / Full-text search pushdown | Not supported |
+| Doris Data Cache integration | Not supported |
+
+## Dataset Layout
+
+A Lance dataset is a **directory** with the following typical structure:
+
+```
+my_dataset.lance/
+├── _transactions/
+├── _versions/
+└── data/
+ ├── fragment-0.lance
+ ├── fragment-1.lance
+ └── ...
+```
+
+When querying via TVF, the `uri` / `file_path` must point to a single `.lance`
data file inside the `data/` subdirectory of the dataset. Doris automatically
resolves the dataset root from this path and reads all fragments belonging to
the dataset.
Review Comment:
But the limitation says only one fragment is read if multiple are globbed.
These can't both be true. With the merged fragment_file logic, the accurate
statement is: each scan range reads
exactly one fragment; a glob over data/*.lance assigns one fragment to
each scan range, producing the full dataset.
##########
versioned_docs/version-4.x/lakehouse/file-formats/lance.md:
##########
@@ -0,0 +1,99 @@
+---
+{
+ "title": "Lance | File Formats",
+ "language": "en",
+ "description": "This document introduces the support for reading Lance
file formats in Doris.",
+ "sidebar_label": "Lance"
+}
+---
+
+# Lance
+
+:::tip
+Lance format support is an **experimental feature** available since Apache
Doris **5.0.0**.
+:::
+
+[Lance](https://lancedb.github.io/lance/) is a modern columnar data format
designed for AI/ML workloads, with native support for vector search, multimodal
data (images, embeddings), and fast random access.
+
+Doris supports reading Lance format files through Table Valued Functions (TVF).
+
+## Supported Features
+
+| Feature | Support |
+|---------|---------|
+| Reading data via Table Valued Function (`s3`, `local`) | Yes |
+| Automatic schema inference | Yes |
+| Column projection | Yes |
+| `WHERE` filter, `LIMIT`, `COUNT(*)`, aggregation | Yes |
+| Multi-fragment datasets | Yes |
+| Reading from Catalog | Not supported |
+| Writing data (Outfile/Export/INSERT INTO TVF) | Not supported |
+| Vector ANN search / Full-text search pushdown | Not supported |
+| Doris Data Cache integration | Not supported |
+
+## Dataset Layout
+
+A Lance dataset is a **directory** with the following typical structure:
+
+```
+my_dataset.lance/
+├── _transactions/
+├── _versions/
+└── data/
+ ├── fragment-0.lance
+ ├── fragment-1.lance
+ └── ...
+```
+
+When querying via TVF, the `uri` / `file_path` must point to a single `.lance`
data file inside the `data/` subdirectory of the dataset. Doris automatically
resolves the dataset root from this path and reads all fragments belonging to
the dataset.
+
+## Usage Examples
+
+### Read from S3
+
+```sql
+SELECT * FROM s3(
+ "uri" = "s3://bucket/path/to/my_dataset.lance/data/fragment.lance",
+ "format" = "lance",
+ "s3.access_key" = "ak",
+ "s3.secret_key" = "sk",
+ "s3.region" = "us-east-1",
+ "s3.endpoint" = "https://s3.us-east-1.amazonaws.com"
+) ORDER BY id LIMIT 10;
+```
+
+### Read from Local Disk
+
+```sql
+-- Get backend_id via: SHOW BACKENDS;
+SELECT * FROM local(
+ "file_path" = "data/my_dataset.lance/data/fragment.lance",
+ "backend_id" = "<backend_id>",
+ "format" = "lance"
+) ORDER BY id LIMIT 10;
+```
+
+### Aggregation over a Multi-Fragment Dataset
Review Comment:
SELECT count(*), min(id), max(id) FROM s3(
"uri" = "s3://bucket/path/to/large.lance/data/fragment.lance",
...
data/fragment.lance points at one specific file — this reads one fragment,
not the whole dataset. To show multi-fragment aggregation, use a glob:
"uri" = "s3://bucket/path/to/large.lance/data/*.lance",
Same for the local example — real Lance datasets have UUID-named fragment
files, so pointing at one by name is fragile.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]