should be it
This commit is contained in:
68
external/duckdb/test/sql/attach/attach_new_compression.test
vendored
Normal file
68
external/duckdb/test/sql/attach/attach_new_compression.test
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
# name: test/sql/attach/attach_new_compression.test
|
||||
# description: Tests attaching database files and using new compression methods
|
||||
# group: [attach]
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/test_new_compression.db' AS db1 (STORAGE_VERSION 'v1.0.0');
|
||||
|
||||
statement ok
|
||||
SET force_compression='roaring'
|
||||
|
||||
statement ok
|
||||
CREATE TABLE db1.tbl AS SELECT CASE WHEN i%2=0 THEN NULL ELSE i END i FROM range(10000) t(i);
|
||||
|
||||
statement ok
|
||||
SET force_compression='zstd';
|
||||
|
||||
statement ok
|
||||
CREATE TABLE db1.str_tbl AS SELECT STRING_AGG('long_string_' || i, '-') FROM range(1000) t(i);
|
||||
|
||||
# verify new compression methods are not used when attaching with a low storage version
|
||||
query I
|
||||
SELECT COUNT(*)>0 FROM pragma_storage_info('db1.tbl') WHERE compression='Roaring'
|
||||
----
|
||||
false
|
||||
|
||||
query I
|
||||
SELECT COUNT(*)>0 FROM pragma_storage_info('db1.str_tbl') WHERE compression='ZSTD'
|
||||
----
|
||||
false
|
||||
|
||||
statement ok
|
||||
DETACH db1
|
||||
|
||||
# attach with a new storage version and re-write the table
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/test_new_compression.db' AS db1 (STORAGE_VERSION 'v1.2.0');
|
||||
|
||||
statement ok
|
||||
SET force_compression='roaring'
|
||||
|
||||
statement ok
|
||||
CREATE TABLE db1.tbl2 AS FROM db1.tbl
|
||||
|
||||
statement ok
|
||||
CHECKPOINT db1
|
||||
|
||||
statement ok
|
||||
SET force_compression='zstd';
|
||||
|
||||
statement ok
|
||||
CREATE TABLE db1.str_tbl2 AS FROM db1.str_tbl
|
||||
|
||||
statement ok
|
||||
CHECKPOINT db1
|
||||
|
||||
# roaring is used now
|
||||
query I
|
||||
SELECT COUNT(*)>0 FROM pragma_storage_info('db1.tbl2') WHERE compression='Roaring'
|
||||
----
|
||||
true
|
||||
|
||||
query I
|
||||
SELECT COUNT(*)>0 FROM pragma_storage_info('db1.str_tbl2') WHERE compression='ZSTD'
|
||||
----
|
||||
true
|
||||
Reference in New Issue
Block a user