Skip to content

Commit 76132f8

Browse files
authored
Merge branch 'main' into codex/update-lance-8-0-0
2 parents c692701 + c348d48 commit 76132f8

7 files changed

Lines changed: 50 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve
66

77
## [Unreleased]
88

9+
### Changed
10+
11+
- `COPY`, `CREATE TABLE`, and CTAS now default new or replaced datasets to Lance data storage version `2.2`.
12+
913
## [0.5.1] - 2026-02-10
1014

1115
### Added

docs/sql.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ COPY (
201201

202202
Notes:
203203
- `mode` supports at least `overwrite` and `append`.
204+
- `data_storage_version` defaults to `2.2` when `COPY` creates or overwrites a dataset. Appends preserve the existing storage version.
204205
- `write_empty_file` controls whether an empty dataset is materialized when the input produces zero rows.
205206

206207
### `CREATE TABLE` / `CTAS` in an attached namespace
@@ -223,6 +224,9 @@ SELECT count(*) FROM ns.main.my_dataset;
223224
DETACH ns;
224225
```
225226

227+
`CREATE TABLE` and CTAS default to data storage version `2.2`. Override it with
228+
`WITH (data_storage_version = '<version>')` when another version is required.
229+
226230
## DML on attached tables
227231

228232
These statements apply to tables inside an attached namespace (e.g. `ns.main.my_table`).

src/include/lance_common.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ static constexpr uint64_t LANCE_DEFAULT_MAX_ROWS_PER_FILE = 1024ULL * 1024ULL;
3232
static constexpr uint64_t LANCE_DEFAULT_MAX_ROWS_PER_GROUP = 1024ULL;
3333
static constexpr uint64_t LANCE_DEFAULT_MAX_BYTES_PER_FILE =
3434
90ULL * 1024ULL * 1024ULL * 1024ULL;
35+
static constexpr const char *LANCE_DEFAULT_DATA_STORAGE_VERSION = "2.2";
3536

3637
void ResolveLanceNamespaceAuth(ClientContext &context, const string &endpoint,
3738
const unordered_map<string, Value> &options,

src/lance_storage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ static string
628628
GetCreateTableDataStorageVersionOption(const CreateTableInfo &create_info) {
629629
auto it = create_info.options.find("data_storage_version");
630630
if (it == create_info.options.end()) {
631-
return "";
631+
return LANCE_DEFAULT_DATA_STORAGE_VERSION;
632632
}
633633
if (!it->second) {
634634
throw BinderException("data_storage_version option cannot be NULL");

src/lance_write.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace duckdb {
1616

1717
struct LanceWriteBindData : public FunctionData {
1818
string mode = "create";
19-
string data_storage_version;
19+
string data_storage_version = LANCE_DEFAULT_DATA_STORAGE_VERSION;
2020
uint64_t max_rows_per_file = LANCE_DEFAULT_MAX_ROWS_PER_FILE;
2121
uint64_t max_rows_per_group = LANCE_DEFAULT_MAX_ROWS_PER_GROUP;
2222
uint64_t max_bytes_per_file = LANCE_DEFAULT_MAX_BYTES_PER_FILE;

test/sql/dml_copy_to.test

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ SELECT sum(id) FROM 'test/.tmp/lance_write_basic.lance';
2424
----
2525
3
2626

27+
# 322E32 is the hexadecimal representation of "2.2" in the manifest.
28+
query I
29+
SELECT contains(hex(content), '322E32')::INTEGER
30+
FROM read_blob('test/.tmp/lance_write_basic.lance/_versions/*.manifest')
31+
ORDER BY last_modified DESC, filename
32+
LIMIT 1;
33+
----
34+
1
35+
2736
statement ok
2837
COPY (
2938
SELECT 3::BIGINT AS id, 'c'::VARCHAR AS s
@@ -81,6 +90,19 @@ SELECT count(*) FROM 'test/.tmp/lance_write_with_version_21.lance';
8190
----
8291
1
8392

93+
statement ok
94+
COPY (
95+
SELECT 2::BIGINT AS id, 'w'::VARCHAR AS s
96+
) TO 'test/.tmp/lance_write_with_version_21.lance' (FORMAT lance, mode 'append');
97+
98+
query I
99+
SELECT contains(hex(content), '322E31')::INTEGER
100+
FROM read_blob('test/.tmp/lance_write_with_version_21.lance/_versions/*.manifest')
101+
ORDER BY last_modified DESC, filename
102+
LIMIT 1;
103+
----
104+
1
105+
84106
statement ok
85107
COPY (
86108
SELECT 1::BIGINT AS id, 'v'::VARCHAR AS s

test/sql/namespace_create_table.test

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ SELECT count(*) FROM ns.main.attach_create_table_empty
1818
----
1919
0
2020

21+
# 322E32 is the hexadecimal representation of "2.2" in the manifest.
22+
query I
23+
SELECT contains(hex(content), '322E32')::INTEGER
24+
FROM read_blob('test/.tmp/nsroot_create_table_125/attach_create_table_empty.lance/_versions/*.manifest')
25+
ORDER BY last_modified DESC, filename
26+
LIMIT 1;
27+
----
28+
1
29+
2130
statement ok
2231
CREATE OR REPLACE TABLE ns.main.attach_create_table_with_version
2332
(id BIGINT, s VARCHAR)
@@ -44,6 +53,14 @@ SELECT count(*) FROM 'test/.tmp/nsroot_create_table_125/attach_create_table_ctas
4453
----
4554
2
4655

56+
query I
57+
SELECT contains(hex(content), '322E32')::INTEGER
58+
FROM read_blob('test/.tmp/nsroot_create_table_125/attach_create_table_ctas.lance/_versions/*.manifest')
59+
ORDER BY last_modified DESC, filename
60+
LIMIT 1;
61+
----
62+
1
63+
4764
statement ok
4865
CREATE OR REPLACE TABLE ns.main.attach_create_table_ctas AS
4966
SELECT 3::BIGINT AS id, 'c'::VARCHAR AS s;

0 commit comments

Comments
 (0)