forked from duckdb/duckdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for a previously problematic scenario
- Loading branch information
Showing
1 changed file
with
72 additions
and
0 deletions.
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
test/sql/storage/compression/dictionary/dictionary_covers_validity.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# name: test/sql/storage/compression/dictionary/dictionary_covers_validity.test | ||
# group: [dictionary] | ||
|
||
load __TEST_DIR__/dictionary_covers_validity | ||
|
||
statement ok | ||
set checkpoint_threshold='10mb'; | ||
|
||
statement ok | ||
CREATE TABLE tbl AS SELECT | ||
{ | ||
'a': i, | ||
'b': NULL::VARCHAR | ||
} col | ||
FROM range(5000) t(i); | ||
|
||
statement ok | ||
INSERT INTO tbl VALUES ( | ||
{ | ||
'a': 10000, | ||
'b': 'hello' | ||
} | ||
); | ||
|
||
statement ok | ||
set force_compression='dictionary'; | ||
|
||
statement ok | ||
force checkpoint; | ||
|
||
# Dictionary covers the validity, so the validity gets replaced with "Empty Validity" | ||
query II | ||
select segment_type, compression from pragma_storage_info('tbl'); | ||
---- | ||
VALIDITY Constant | ||
BIGINT BitPacking | ||
VALIDITY Constant | ||
VARCHAR Dictionary | ||
VALIDITY Empty Validity | ||
|
||
statement ok | ||
INSERT INTO tbl VALUES ( | ||
{ | ||
'a': 10000, | ||
'b': 'hello' | ||
} | ||
); | ||
|
||
# Now force a different compression method, that doesn't cover the validity | ||
statement ok | ||
set force_compression='fsst'; | ||
|
||
statement ok | ||
force checkpoint; | ||
|
||
# During checkpoint this will scan the dictionary compressed segments to get the validity | ||
# this then gets compressed as normal (since FSST does not cover the validity) | ||
query II | ||
select segment_type, compression from pragma_storage_info('tbl'); | ||
---- | ||
VALIDITY Constant | ||
BIGINT BitPacking | ||
VALIDITY Constant | ||
VARCHAR FSST | ||
VALIDITY Roaring | ||
|
||
query I | ||
SELECT col FROM tbl ORDER BY col.a DESC LIMIT 3; | ||
---- | ||
{'a': 10000, 'b': hello} | ||
{'a': 10000, 'b': hello} | ||
{'a': 4999, 'b': NULL} |