should be it
This commit is contained in:
335
external/duckdb/test/sql/storage/compression/alp/alp_inf_null_nan.test
vendored
Normal file
335
external/duckdb/test/sql/storage/compression/alp/alp_inf_null_nan.test
vendored
Normal file
@@ -0,0 +1,335 @@
|
||||
# name: test/sql/storage/compression/alp/alp_inf_null_nan.test
|
||||
# group: [alp]
|
||||
|
||||
# load the DB from disk
|
||||
load __TEST_DIR__/test_alp_nulls.db
|
||||
|
||||
foreach compression uncompressed alp
|
||||
|
||||
# Set the compression algorithm
|
||||
|
||||
statement ok
|
||||
pragma force_compression='${compression}'
|
||||
|
||||
# Create tables
|
||||
|
||||
statement ok
|
||||
create table tbl1_${compression}(
|
||||
a INTEGER DEFAULT 5,
|
||||
b VARCHAR DEFAULT 'test',
|
||||
c BOOL DEFAULT false,
|
||||
d DOUBLE,
|
||||
e TEXT default 'null',
|
||||
f FLOAT
|
||||
);
|
||||
|
||||
statement ok
|
||||
create table tbl2_${compression}(
|
||||
a INTEGER DEFAULT 5,
|
||||
b VARCHAR DEFAULT 'test',
|
||||
c BOOL DEFAULT false,
|
||||
d DOUBLE,
|
||||
e TEXT default 'null',
|
||||
f FLOAT
|
||||
);
|
||||
|
||||
statement ok
|
||||
create table tbl3_${compression}(
|
||||
a INTEGER DEFAULT 5,
|
||||
b VARCHAR DEFAULT 'test',
|
||||
c BOOL DEFAULT false,
|
||||
d DOUBLE,
|
||||
e TEXT default 'null',
|
||||
f FLOAT
|
||||
);
|
||||
|
||||
# Populate tables
|
||||
|
||||
# Mixed NULLs
|
||||
statement ok
|
||||
insert into tbl1_${compression}(d,f) VALUES
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity');
|
||||
|
||||
# Only NULLS
|
||||
statement ok
|
||||
insert into tbl2_${compression}(d,f) VALUES
|
||||
(NULL, NULL),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', 'Infinity'),
|
||||
('Infinity', '-Infinity'),
|
||||
('Infinity', '-Infinity'),
|
||||
('Infinity', '-Infinity'),
|
||||
('Infinity', '-Infinity'),
|
||||
('Infinity', '-Infinity'),
|
||||
('-Infinity', '-Infinity'),
|
||||
('-Infinity', '-Infinity'),
|
||||
('-Infinity', '-Infinity'),
|
||||
('-Infinity', '-Infinity'),
|
||||
('-Infinity', '-Infinity'),
|
||||
('-Infinity', '-Infinity'),
|
||||
(0, 0),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL);
|
||||
|
||||
# Starting with NULLS
|
||||
statement ok
|
||||
insert into tbl3_${compression}(d,f) VALUES
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
('-Infinity', '-Infinity'),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
('-Infinity', '-Infinity'),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
('-Infinity', '-Infinity'),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
('-Infinity', '-Infinity'),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
('-Infinity', '-Infinity'),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
('-Infinity', 'Infinity'),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
('-Infinity', 'Infinity'),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
('-Infinity', 'Infinity'),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
('-Infinity', 'Infinity'),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
('Infinity', 'Infinity'),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
('Infinity', 'Infinity'),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
('Infinity', 'Infinity'),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
('Infinity', 'Infinity'),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
('Infinity', 'Infinity'),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
('Infinity', 'Infinity'),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(NULL, NULL),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
('NaN', 'NaN'),
|
||||
('NaN', 'NaN'),
|
||||
('NaN', 'NaN');
|
||||
|
||||
# Force a checkpoint
|
||||
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
endloop
|
||||
|
||||
# Assert that the scanned results are the same
|
||||
|
||||
#tbl1
|
||||
|
||||
query II nosort r1
|
||||
select d, f from tbl1_uncompressed;
|
||||
----
|
||||
|
||||
query II nosort r1
|
||||
select d, f from tbl1_alp;
|
||||
----
|
||||
|
||||
#tbl2
|
||||
|
||||
query II nosort r2
|
||||
select d, f from tbl2_uncompressed;
|
||||
----
|
||||
|
||||
query II nosort r2
|
||||
select d, f from tbl2_alp;
|
||||
----
|
||||
|
||||
# tbl3
|
||||
|
||||
query II nosort r3
|
||||
select d, f from tbl3_uncompressed;
|
||||
----
|
||||
|
||||
query II nosort r3
|
||||
select d, f from tbl3_alp;
|
||||
----
|
||||
127
external/duckdb/test/sql/storage/compression/alp/alp_list_skip.test
vendored
Normal file
127
external/duckdb/test/sql/storage/compression/alp/alp_list_skip.test
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
# name: test/sql/storage/compression/alp/alp_list_skip.test
|
||||
# description: Test skipping of small lists in alp
|
||||
# group: [alp]
|
||||
|
||||
# load the DB from disk
|
||||
load __TEST_DIR__/test_alp_list_skip.db
|
||||
|
||||
foreach comp alp alprd
|
||||
|
||||
statement ok
|
||||
SET force_compression='${comp}'
|
||||
|
||||
# Create a table with random doubles of limited precision compressed as Uncompressed
|
||||
# This data should achieve x6 compression ratio
|
||||
statement ok
|
||||
create or replace table list_doubles as select 5700 i, [5700.0] l UNION ALL select i, CASE WHEN i%128=0 THEN [i::DOUBLE] ELSE []::DOUBLE[] END as data from range(10000) tbl(i) union all select 5700, [i] FROM range(100) tbl(i);
|
||||
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
query II
|
||||
SELECT * FROM list_doubles WHERE i=5700
|
||||
----
|
||||
5700 [5700.0]
|
||||
5700 []
|
||||
5700 [0.0]
|
||||
5700 [1.0]
|
||||
5700 [2.0]
|
||||
5700 [3.0]
|
||||
5700 [4.0]
|
||||
5700 [5.0]
|
||||
5700 [6.0]
|
||||
5700 [7.0]
|
||||
5700 [8.0]
|
||||
5700 [9.0]
|
||||
5700 [10.0]
|
||||
5700 [11.0]
|
||||
5700 [12.0]
|
||||
5700 [13.0]
|
||||
5700 [14.0]
|
||||
5700 [15.0]
|
||||
5700 [16.0]
|
||||
5700 [17.0]
|
||||
5700 [18.0]
|
||||
5700 [19.0]
|
||||
5700 [20.0]
|
||||
5700 [21.0]
|
||||
5700 [22.0]
|
||||
5700 [23.0]
|
||||
5700 [24.0]
|
||||
5700 [25.0]
|
||||
5700 [26.0]
|
||||
5700 [27.0]
|
||||
5700 [28.0]
|
||||
5700 [29.0]
|
||||
5700 [30.0]
|
||||
5700 [31.0]
|
||||
5700 [32.0]
|
||||
5700 [33.0]
|
||||
5700 [34.0]
|
||||
5700 [35.0]
|
||||
5700 [36.0]
|
||||
5700 [37.0]
|
||||
5700 [38.0]
|
||||
5700 [39.0]
|
||||
5700 [40.0]
|
||||
5700 [41.0]
|
||||
5700 [42.0]
|
||||
5700 [43.0]
|
||||
5700 [44.0]
|
||||
5700 [45.0]
|
||||
5700 [46.0]
|
||||
5700 [47.0]
|
||||
5700 [48.0]
|
||||
5700 [49.0]
|
||||
5700 [50.0]
|
||||
5700 [51.0]
|
||||
5700 [52.0]
|
||||
5700 [53.0]
|
||||
5700 [54.0]
|
||||
5700 [55.0]
|
||||
5700 [56.0]
|
||||
5700 [57.0]
|
||||
5700 [58.0]
|
||||
5700 [59.0]
|
||||
5700 [60.0]
|
||||
5700 [61.0]
|
||||
5700 [62.0]
|
||||
5700 [63.0]
|
||||
5700 [64.0]
|
||||
5700 [65.0]
|
||||
5700 [66.0]
|
||||
5700 [67.0]
|
||||
5700 [68.0]
|
||||
5700 [69.0]
|
||||
5700 [70.0]
|
||||
5700 [71.0]
|
||||
5700 [72.0]
|
||||
5700 [73.0]
|
||||
5700 [74.0]
|
||||
5700 [75.0]
|
||||
5700 [76.0]
|
||||
5700 [77.0]
|
||||
5700 [78.0]
|
||||
5700 [79.0]
|
||||
5700 [80.0]
|
||||
5700 [81.0]
|
||||
5700 [82.0]
|
||||
5700 [83.0]
|
||||
5700 [84.0]
|
||||
5700 [85.0]
|
||||
5700 [86.0]
|
||||
5700 [87.0]
|
||||
5700 [88.0]
|
||||
5700 [89.0]
|
||||
5700 [90.0]
|
||||
5700 [91.0]
|
||||
5700 [92.0]
|
||||
5700 [93.0]
|
||||
5700 [94.0]
|
||||
5700 [95.0]
|
||||
5700 [96.0]
|
||||
5700 [97.0]
|
||||
5700 [98.0]
|
||||
5700 [99.0]
|
||||
|
||||
endloop
|
||||
44
external/duckdb/test/sql/storage/compression/alp/alp_many_segments.test_slow
vendored
Normal file
44
external/duckdb/test/sql/storage/compression/alp/alp_many_segments.test_slow
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# name: test/sql/storage/compression/alp/alp_many_segments.test_slow
|
||||
# description: Test storage of alp, but simple
|
||||
# group: [alp]
|
||||
|
||||
# load the DB from disk
|
||||
load __TEST_DIR__/test_alp.db
|
||||
|
||||
statement ok
|
||||
PRAGMA force_compression='uncompressed'
|
||||
|
||||
# Create a table with random doubles of limited precision compressed as Uncompressed
|
||||
# This data should achieve x6 compression ratio
|
||||
statement ok
|
||||
create table random_double as select round(random(), 6)::DOUBLE as data from range(500000) tbl(i);
|
||||
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
query I
|
||||
SELECT compression FROM pragma_storage_info('random_double') WHERE segment_type == 'double' AND compression != 'Uncompressed';
|
||||
----
|
||||
|
||||
# Now create a duplicate of this table, compressed with ALP instead
|
||||
statement ok
|
||||
PRAGMA force_compression='alp'
|
||||
|
||||
statement ok
|
||||
create table random_alp_double as select * from random_double;
|
||||
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
query I
|
||||
SELECT compression FROM pragma_storage_info('random_alp_double') WHERE segment_type == 'double' AND compression != 'ALP';
|
||||
----
|
||||
|
||||
# Assert that the data was not corrupted by compressing to ALP
|
||||
query I sort r1
|
||||
select * from random_double;
|
||||
----
|
||||
|
||||
query I sort r1
|
||||
select * from random_alp_double;
|
||||
----
|
||||
44
external/duckdb/test/sql/storage/compression/alp/alp_many_segments_float.test_slow
vendored
Normal file
44
external/duckdb/test/sql/storage/compression/alp/alp_many_segments_float.test_slow
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# name: test/sql/storage/compression/alp/alp_many_segments_float.test_slow
|
||||
# description: Test storage of alp, but simple
|
||||
# group: [alp]
|
||||
|
||||
# load the DB from disk
|
||||
load __TEST_DIR__/test_alp.db
|
||||
|
||||
statement ok
|
||||
PRAGMA force_compression='uncompressed'
|
||||
|
||||
# Create a table with random floats of limited precision compressed as Uncompressed
|
||||
# This data should achieve x6 compression ratio
|
||||
statement ok
|
||||
create table random_float as select round(random(), 3)::FLOAT as data from range(500000) tbl(i);
|
||||
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
query I
|
||||
SELECT compression FROM pragma_storage_info('random_float') WHERE segment_type == 'float' AND compression != 'Uncompressed';
|
||||
----
|
||||
|
||||
# Now create a duplicate of this table, compressed with ALP instead
|
||||
statement ok
|
||||
PRAGMA force_compression='alp'
|
||||
|
||||
statement ok
|
||||
create table random_alp_float as select * from random_float;
|
||||
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
query I
|
||||
SELECT compression FROM pragma_storage_info('random_alp_float') WHERE segment_type == 'float' AND compression != 'ALP';
|
||||
----
|
||||
|
||||
# Assert that the data was not corrupted by compressing to ALP
|
||||
query I sort r1
|
||||
select * from random_float;
|
||||
----
|
||||
|
||||
query I sort r1
|
||||
select * from random_alp_float;
|
||||
----
|
||||
44
external/duckdb/test/sql/storage/compression/alp/alp_middle_flush.test_slow
vendored
Normal file
44
external/duckdb/test/sql/storage/compression/alp/alp_middle_flush.test_slow
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# name: test/sql/storage/compression/alp/alp_middle_flush.test_slow
|
||||
# description: Test storage of alp, but simple
|
||||
# group: [alp]
|
||||
|
||||
# load the DB from disk
|
||||
load __TEST_DIR__/test_alp.db
|
||||
|
||||
statement ok
|
||||
PRAGMA force_compression='uncompressed'
|
||||
|
||||
# Create a table with random doubles of limited precision compressed as Uncompressed
|
||||
# This data should achieve x6 compression ratio
|
||||
statement ok
|
||||
create table random_double as select round(random(), 6)::DOUBLE as data from range(110000) tbl(i);
|
||||
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
query I
|
||||
SELECT compression FROM pragma_storage_info('random_double') WHERE segment_type == 'double' AND compression != 'Uncompressed';
|
||||
----
|
||||
|
||||
# Now create a duplicate of this table, compressed with ALP instead
|
||||
statement ok
|
||||
PRAGMA force_compression='alp'
|
||||
|
||||
statement ok
|
||||
create table random_alp_double as select * from random_double;
|
||||
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
query I
|
||||
SELECT compression FROM pragma_storage_info('random_alp_double') WHERE segment_type == 'double' AND compression != 'ALP';
|
||||
----
|
||||
|
||||
# Assert that the data was not corrupted by compressing to ALP
|
||||
query I sort r1
|
||||
select * from random_double;
|
||||
----
|
||||
|
||||
query I sort r1
|
||||
select * from random_alp_double;
|
||||
----
|
||||
36
external/duckdb/test/sql/storage/compression/alp/alp_min_max.test
vendored
Normal file
36
external/duckdb/test/sql/storage/compression/alp/alp_min_max.test
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
# name: test/sql/storage/compression/alp/alp_min_max.test
|
||||
# group: [alp]
|
||||
|
||||
load __TEST_DIR__/alp_min_max.db
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
statement ok
|
||||
PRAGMA force_compression='alp';
|
||||
|
||||
foreach type DOUBLE FLOAT
|
||||
|
||||
statement ok
|
||||
CREATE TABLE all_types AS SELECT ${type} FROM test_all_types();
|
||||
|
||||
loop i 0 15
|
||||
|
||||
statement ok
|
||||
INSERT INTO all_types SELECT ${type} FROM all_types;
|
||||
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
query I
|
||||
SELECT compression FROM pragma_storage_info('all_types') WHERE segment_type == '${type}' AND compression != 'ALP';
|
||||
----
|
||||
|
||||
# i
|
||||
endloop
|
||||
|
||||
statement ok
|
||||
DROP TABLE all_types;
|
||||
|
||||
#type
|
||||
endloop
|
||||
45
external/duckdb/test/sql/storage/compression/alp/alp_negative_numbers.test
vendored
Normal file
45
external/duckdb/test/sql/storage/compression/alp/alp_negative_numbers.test
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
# name: test/sql/storage/compression/alp/alp_negative_numbers.test
|
||||
# description: Test storage of alp, but simple
|
||||
# group: [alp]
|
||||
|
||||
# load the DB from disk
|
||||
load __TEST_DIR__/test_alp.db
|
||||
|
||||
statement ok
|
||||
PRAGMA force_compression='uncompressed'
|
||||
|
||||
# Create a table with random doubles of limited precision compressed as Uncompressed
|
||||
# This data should achieve x6 compression ratio
|
||||
statement ok
|
||||
create table random_double as select round(cos(1 / (random() + 0.001)), 5)::DOUBLE * -1 as data from range(1023) tbl(i);
|
||||
insert into random_double values (-0.0::DOUBLE);
|
||||
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
query I
|
||||
SELECT compression FROM pragma_storage_info('random_double') WHERE segment_type == 'double' AND compression != 'Uncompressed';
|
||||
----
|
||||
|
||||
# Now create a duplicate of this table, compressed with ALP instead
|
||||
statement ok
|
||||
PRAGMA force_compression='alp'
|
||||
|
||||
statement ok
|
||||
create table random_alp_double as select * from random_double;
|
||||
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
query I
|
||||
SELECT compression FROM pragma_storage_info('random_alp_double') WHERE segment_type == 'double' AND compression != 'ALP';
|
||||
----
|
||||
|
||||
# Assert that the data was not corrupted by compressing to ALP
|
||||
query I sort r1
|
||||
select * from random_double;
|
||||
----
|
||||
|
||||
query I sort r1
|
||||
select * from random_alp_double;
|
||||
----
|
||||
342
external/duckdb/test/sql/storage/compression/alp/alp_nulls.test
vendored
Normal file
342
external/duckdb/test/sql/storage/compression/alp/alp_nulls.test
vendored
Normal file
@@ -0,0 +1,342 @@
|
||||
# name: test/sql/storage/compression/alp/alp_nulls.test
|
||||
# group: [alp]
|
||||
|
||||
# load the DB from disk
|
||||
load __TEST_DIR__/test_alp_nulls.db
|
||||
|
||||
foreach compression uncompressed alp
|
||||
|
||||
# Set the compression algorithm
|
||||
|
||||
statement ok
|
||||
pragma force_compression='${compression}'
|
||||
|
||||
# Create tables
|
||||
|
||||
statement ok
|
||||
create table tbl1_${compression}(
|
||||
a INTEGER DEFAULT 5,
|
||||
b VARCHAR DEFAULT 'test',
|
||||
c BOOL DEFAULT false,
|
||||
d DOUBLE,
|
||||
e TEXT default 'null',
|
||||
f FLOAT
|
||||
);
|
||||
|
||||
statement ok
|
||||
create table tbl2_${compression}(
|
||||
a INTEGER DEFAULT 5,
|
||||
b VARCHAR DEFAULT 'test',
|
||||
c BOOL DEFAULT false,
|
||||
d DOUBLE,
|
||||
e TEXT default 'null',
|
||||
f FLOAT
|
||||
);
|
||||
|
||||
statement ok
|
||||
create table tbl3_${compression}(
|
||||
a INTEGER DEFAULT 5,
|
||||
b VARCHAR DEFAULT 'test',
|
||||
c BOOL DEFAULT false,
|
||||
d DOUBLE,
|
||||
e TEXT default 'null',
|
||||
f FLOAT
|
||||
);
|
||||
|
||||
# Populate tables
|
||||
|
||||
# Mixed NULLs
|
||||
statement ok
|
||||
insert into tbl1_${compression}(d,f) VALUES
|
||||
(NULL, 1.2314234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(NULL, 1.2314234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(NULL, 1.2314234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(NULL, 1.2314234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(NULL, 1.2314234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(NULL, 1.2314234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(NULL, NULL);
|
||||
|
||||
# Only NULLS
|
||||
statement ok
|
||||
insert into tbl2_${compression}(d,f) VALUES
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL);
|
||||
|
||||
# Starting with NULLS
|
||||
statement ok
|
||||
insert into tbl3_${compression}(d,f) VALUES
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(NULL, NULL),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142),
|
||||
(7034.34968234, 93472948.98034),
|
||||
(1.213123, 1.232142);
|
||||
|
||||
# Force a checkpoint
|
||||
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
endloop
|
||||
|
||||
# Assert that the scanned results are the same
|
||||
|
||||
#tbl1
|
||||
|
||||
query II nosort r1
|
||||
select d, f from tbl1_uncompressed;
|
||||
----
|
||||
|
||||
query II nosort r1
|
||||
select d, f from tbl1_alp;
|
||||
----
|
||||
|
||||
#tbl2
|
||||
|
||||
query II nosort r2
|
||||
select d, f from tbl2_uncompressed;
|
||||
----
|
||||
|
||||
query II nosort r2
|
||||
select d, f from tbl2_alp;
|
||||
----
|
||||
|
||||
# tbl3
|
||||
|
||||
query II nosort r3
|
||||
select d, f from tbl3_uncompressed;
|
||||
----
|
||||
|
||||
query II nosort r3
|
||||
select d, f from tbl3_alp;
|
||||
----
|
||||
129
external/duckdb/test/sql/storage/compression/alp/alp_nulls_simple.test
vendored
Normal file
129
external/duckdb/test/sql/storage/compression/alp/alp_nulls_simple.test
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
# name: test/sql/storage/compression/alp/alp_nulls_simple.test
|
||||
# group: [alp]
|
||||
|
||||
# load the DB from disk
|
||||
load __TEST_DIR__/test_alp_nulls.db
|
||||
|
||||
foreach compression uncompressed alp
|
||||
|
||||
# Set the compression algorithm
|
||||
|
||||
statement ok
|
||||
pragma force_compression='${compression}'
|
||||
|
||||
# Create tables
|
||||
|
||||
statement ok
|
||||
create table tbl1_${compression}(
|
||||
a INTEGER DEFAULT 5,
|
||||
b VARCHAR DEFAULT 'test',
|
||||
c BOOL DEFAULT false,
|
||||
d DOUBLE,
|
||||
e TEXT default 'null',
|
||||
f FLOAT
|
||||
);
|
||||
|
||||
# Populate tables
|
||||
|
||||
# Mixed NULLs
|
||||
statement ok
|
||||
insert into tbl1_${compression}(d,f) VALUES
|
||||
(NULL, 1.2314234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(NULL, 1.2314234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(NULL, 1.2314234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(NULL, 1.2314234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(NULL, 1.2314234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(NULL, 1.2314234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(324213.23123, NULL),
|
||||
(NULL, NULL),
|
||||
(21312.23412, 12.123234),
|
||||
(NULL, NULL);
|
||||
|
||||
# Force a checkpoint
|
||||
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
endloop
|
||||
|
||||
# Assert that the scanned results are the same
|
||||
|
||||
#tbl1
|
||||
|
||||
query II nosort r1
|
||||
select d, f from tbl1_uncompressed;
|
||||
----
|
||||
|
||||
query II nosort r1
|
||||
select d, f from tbl1_alp;
|
||||
----
|
||||
|
||||
51
external/duckdb/test/sql/storage/compression/alp/alp_read.test_slow
vendored
Normal file
51
external/duckdb/test/sql/storage/compression/alp/alp_read.test_slow
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
# name: test/sql/storage/compression/alp/alp_read.test_slow
|
||||
# group: [alp]
|
||||
|
||||
require parquet
|
||||
|
||||
require httpfs
|
||||
|
||||
load __TEST_DIR__/test_alp.db
|
||||
|
||||
statement ok
|
||||
DROP TABLE IF EXISTS temperatures;
|
||||
|
||||
statement ok
|
||||
pragma threads=1;
|
||||
|
||||
statement ok
|
||||
PRAGMA force_compression='alp';
|
||||
|
||||
statement ok
|
||||
CREATE TABLE temperatures (
|
||||
temperature DOUBLE
|
||||
);
|
||||
|
||||
statement ok
|
||||
INSERT INTO temperatures SELECT temp from 'https://github.com/duckdb/duckdb-data/releases/download/v1.0/city_temperature.parquet' t(temp), range(1);
|
||||
|
||||
statement ok
|
||||
CHECKPOINT;
|
||||
|
||||
statement ok
|
||||
create table reference_temperatures (
|
||||
temperature DOUBLE
|
||||
);
|
||||
|
||||
statement ok
|
||||
PRAGMA force_compression='uncompressed';
|
||||
|
||||
statement ok
|
||||
INSERT INTO reference_temperatures SELECT temp from 'https://github.com/duckdb/duckdb-data/releases/download/v1.0/city_temperature.parquet' t(temp), range(1);
|
||||
|
||||
statement ok
|
||||
checkpoint;
|
||||
|
||||
query I nosort r1
|
||||
select temperature from reference_temperatures;
|
||||
----
|
||||
|
||||
query I nosort r1
|
||||
select temperature from temperatures
|
||||
----
|
||||
|
||||
44
external/duckdb/test/sql/storage/compression/alp/alp_simple.test
vendored
Normal file
44
external/duckdb/test/sql/storage/compression/alp/alp_simple.test
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# name: test/sql/storage/compression/alp/alp_simple.test
|
||||
# description: Test storage of alp, but simple
|
||||
# group: [alp]
|
||||
|
||||
# load the DB from disk
|
||||
load __TEST_DIR__/test_alp.db
|
||||
|
||||
statement ok
|
||||
PRAGMA force_compression='uncompressed'
|
||||
|
||||
# Create a table with random doubles of limited precision compressed as Uncompressed
|
||||
# This data should achieve x6 compression ratio
|
||||
statement ok
|
||||
create table random_double as select round(random(), 6)::DOUBLE as data from range(1024) tbl(i);
|
||||
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
query I
|
||||
SELECT compression FROM pragma_storage_info('random_double') WHERE segment_type == 'double' AND compression != 'Uncompressed';
|
||||
----
|
||||
|
||||
# Now create a duplicate of this table, compressed with ALP instead
|
||||
statement ok
|
||||
PRAGMA force_compression='alp'
|
||||
|
||||
statement ok
|
||||
create table random_alp_double as select * from random_double;
|
||||
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
query I
|
||||
SELECT compression FROM pragma_storage_info('random_alp_double') WHERE segment_type == 'double' AND compression != 'ALP';
|
||||
----
|
||||
|
||||
# Assert that the data was not corrupted by compressing to ALP
|
||||
query I sort r1
|
||||
select * from random_double;
|
||||
----
|
||||
|
||||
query I sort r1
|
||||
select * from random_alp_double;
|
||||
----
|
||||
44
external/duckdb/test/sql/storage/compression/alp/alp_simple_float.test
vendored
Normal file
44
external/duckdb/test/sql/storage/compression/alp/alp_simple_float.test
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# name: test/sql/storage/compression/alp/alp_simple_float.test
|
||||
# description: Test storage of alp, but simple
|
||||
# group: [alp]
|
||||
|
||||
# load the DB from disk
|
||||
load __TEST_DIR__/test_alp.db
|
||||
|
||||
statement ok
|
||||
PRAGMA force_compression='uncompressed'
|
||||
|
||||
# Create a table with random floats of limited precision compressed as Uncompressed
|
||||
# This data should achieve x6 compression ratio
|
||||
statement ok
|
||||
create table random_float as select round(random(), 6)::FLOAT as data from range(1024) tbl(i);
|
||||
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
query I
|
||||
SELECT compression FROM pragma_storage_info('random_float') WHERE segment_type == 'float' AND compression != 'Uncompressed';
|
||||
----
|
||||
|
||||
# Now create a duplicate of this table, compressed with ALP instead
|
||||
statement ok
|
||||
PRAGMA force_compression='alp'
|
||||
|
||||
statement ok
|
||||
create table random_alp_float as select * from random_float;
|
||||
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
query I
|
||||
SELECT compression FROM pragma_storage_info('random_alp_float') WHERE segment_type == 'float' AND compression != 'ALP';
|
||||
----
|
||||
|
||||
# Assert that the data was not corrupted by compressing to ALP
|
||||
query I sort r1
|
||||
select * from random_float;
|
||||
----
|
||||
|
||||
query I sort r1
|
||||
select * from random_alp_float;
|
||||
----
|
||||
55
external/duckdb/test/sql/storage/compression/alp/alp_skip.test_slow
vendored
Normal file
55
external/duckdb/test/sql/storage/compression/alp/alp_skip.test_slow
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
# name: test/sql/storage/compression/alp/alp_skip.test_slow
|
||||
# group: [alp]
|
||||
|
||||
# load the DB from disk
|
||||
load __TEST_DIR__/test_alp.db
|
||||
|
||||
statement ok
|
||||
pragma enable_verification;
|
||||
|
||||
statement ok
|
||||
pragma disable_optimizer;
|
||||
|
||||
statement ok
|
||||
pragma force_compression='uncompressed'
|
||||
|
||||
# Create the data for the columns
|
||||
statement ok
|
||||
create table temp_table as select round(random(), 6)::DOUBLE * 100 as col, j from range(10240) tbl(j);
|
||||
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
foreach compression ALP Uncompressed
|
||||
|
||||
# Ensure the correct compression is used
|
||||
statement ok
|
||||
pragma force_compression='${compression}'
|
||||
|
||||
# Setup
|
||||
statement ok
|
||||
create table tbl_${compression} as select * from temp_table;
|
||||
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
query I
|
||||
SELECT compression FROM pragma_storage_info('tbl_${compression}') WHERE segment_type == 'double' AND compression != '${compression}';
|
||||
----
|
||||
|
||||
# compression
|
||||
endloop
|
||||
|
||||
loop i 1 1024
|
||||
|
||||
query II
|
||||
select x as x_${i}, y as y_${i} from (
|
||||
select
|
||||
(select col from tbl_alp where (j > (${i} * 1024)) except select col from tbl_uncompressed where (j > (${i} * 1024))) as x,
|
||||
(select col from tbl_uncompressed where (j > (${i} * 1024)) except select col from tbl_alp where (j > (${i} * 1024))) as y
|
||||
);
|
||||
----
|
||||
NULL NULL
|
||||
|
||||
# i
|
||||
endloop
|
||||
94
external/duckdb/test/sql/storage/compression/alp/alp_stress_test.test_slow
vendored
Normal file
94
external/duckdb/test/sql/storage/compression/alp/alp_stress_test.test_slow
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
# name: test/sql/storage/compression/alp/alp_stress_test.test_slow
|
||||
# group: [alp]
|
||||
|
||||
load __TEST_DIR__/alp_min_max.db
|
||||
|
||||
foreach type DOUBLE FLOAT
|
||||
|
||||
statement ok
|
||||
pragma force_compression='uncompressed'
|
||||
|
||||
# Create the initial data to start with (without this Constant compression will be used at first)
|
||||
statement ok
|
||||
create table temp_table as select round(random(), 6)::${type} * 100 from range(5);
|
||||
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
foreach compression ALP Uncompressed
|
||||
|
||||
# Ensure the correct compression is used
|
||||
statement ok
|
||||
pragma force_compression='${compression}'
|
||||
|
||||
# Setup
|
||||
statement ok
|
||||
create table ${compression}_tbl(
|
||||
data ${type}
|
||||
);
|
||||
|
||||
statement ok
|
||||
insert into ${compression}_tbl select * from temp_table;
|
||||
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
# compression
|
||||
endloop
|
||||
|
||||
statement ok
|
||||
drop table temp_table;
|
||||
|
||||
# ---------------- MAIN LOOP ----------------
|
||||
|
||||
loop i 0 10240
|
||||
|
||||
# Create a temporary table containing the value we want to add to both tables
|
||||
statement ok
|
||||
create table temp_table as select random()::${type} * 100 + ${i};
|
||||
|
||||
foreach compression ALP Uncompressed
|
||||
|
||||
# Ensure the correct compression is used
|
||||
statement ok
|
||||
pragma force_compression='${compression}'
|
||||
|
||||
# Insert a single value into the table
|
||||
statement ok
|
||||
insert into ${compression}_tbl select * from temp_table;
|
||||
|
||||
# Checkpoint the table with the newly added data
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
# compression
|
||||
endloop
|
||||
|
||||
statement ok
|
||||
drop table temp_table;
|
||||
|
||||
# ---------------- VERIFY CORRECTNESS ----------------
|
||||
|
||||
query II
|
||||
select x as x_${i}, y as y_${i} from (
|
||||
select
|
||||
(select data from alp_tbl except select data from uncompressed_tbl) as x,
|
||||
(select data from uncompressed_tbl except select data from alp_tbl) as y
|
||||
);
|
||||
----
|
||||
NULL NULL
|
||||
|
||||
# i
|
||||
endloop
|
||||
|
||||
# Teardown
|
||||
foreach compression alp uncompressed
|
||||
|
||||
statement ok
|
||||
drop table ${compression}_tbl;
|
||||
|
||||
# compression
|
||||
endloop
|
||||
|
||||
# type
|
||||
endloop
|
||||
753
external/duckdb/test/sql/storage/compression/alp/alp_tpcds.test_slow
vendored
Normal file
753
external/duckdb/test/sql/storage/compression/alp/alp_tpcds.test_slow
vendored
Normal file
@@ -0,0 +1,753 @@
|
||||
# name: test/sql/storage/compression/alp/alp_tpcds.test_slow
|
||||
# group: [alp]
|
||||
|
||||
require tpcds
|
||||
|
||||
# load the DB from disk
|
||||
load __TEST_DIR__/test_alp.db
|
||||
|
||||
#statement ok
|
||||
#pragma threads=1
|
||||
|
||||
statement ok
|
||||
PRAGMA force_compression='alp';
|
||||
|
||||
statement ok
|
||||
call dsdgen(sf=1, suffix='_original');
|
||||
|
||||
statement ok
|
||||
PRAGMA default_null_order='NULLS LAST'
|
||||
|
||||
# Test both DOUBLE and FLOAT
|
||||
|
||||
foreach type DOUBLE FLOAT
|
||||
|
||||
# Create tables
|
||||
|
||||
statement ok
|
||||
CREATE TABLE web_site(
|
||||
web_site_sk ${type},
|
||||
web_site_id VARCHAR,
|
||||
web_rec_start_date DATE,
|
||||
web_rec_end_date DATE,
|
||||
web_name VARCHAR,
|
||||
web_open_date_sk ${type},
|
||||
web_close_date_sk ${type},
|
||||
web_class VARCHAR,
|
||||
web_manager VARCHAR,
|
||||
web_mkt_id ${type},
|
||||
web_mkt_class VARCHAR,
|
||||
web_mkt_desc VARCHAR,
|
||||
web_market_manager VARCHAR,
|
||||
web_company_id ${type},
|
||||
web_company_name VARCHAR,
|
||||
web_street_number VARCHAR,
|
||||
web_street_name VARCHAR,
|
||||
web_street_type VARCHAR,
|
||||
web_suite_number VARCHAR,
|
||||
web_city VARCHAR,
|
||||
web_county VARCHAR,
|
||||
web_state VARCHAR,
|
||||
web_zip VARCHAR,
|
||||
web_country VARCHAR,
|
||||
web_gmt_offset ${type},
|
||||
web_tax_percentage ${type}
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE web_sales(
|
||||
ws_sold_date_sk ${type},
|
||||
ws_sold_time_sk ${type},
|
||||
ws_ship_date_sk ${type},
|
||||
ws_item_sk ${type},
|
||||
ws_bill_customer_sk ${type},
|
||||
ws_bill_cdemo_sk ${type},
|
||||
ws_bill_hdemo_sk ${type},
|
||||
ws_bill_addr_sk ${type},
|
||||
ws_ship_customer_sk ${type},
|
||||
ws_ship_cdemo_sk ${type},
|
||||
ws_ship_hdemo_sk ${type},
|
||||
ws_ship_addr_sk ${type},
|
||||
ws_web_page_sk ${type},
|
||||
ws_web_site_sk ${type},
|
||||
ws_ship_mode_sk ${type},
|
||||
ws_warehouse_sk ${type},
|
||||
ws_promo_sk ${type},
|
||||
ws_order_number ${type},
|
||||
ws_quantity ${type},
|
||||
ws_wholesale_cost ${type},
|
||||
ws_list_price ${type},
|
||||
ws_sales_price ${type},
|
||||
ws_ext_discount_amt ${type},
|
||||
ws_ext_sales_price ${type},
|
||||
ws_ext_wholesale_cost ${type},
|
||||
ws_ext_list_price ${type},
|
||||
ws_ext_tax ${type},
|
||||
ws_coupon_amt ${type},
|
||||
ws_ext_ship_cost ${type},
|
||||
ws_net_paid ${type},
|
||||
ws_net_paid_inc_tax ${type},
|
||||
ws_net_paid_inc_ship ${type},
|
||||
ws_net_paid_inc_ship_tax ${type},
|
||||
ws_net_profit ${type}
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE web_returns(
|
||||
wr_returned_date_sk ${type},
|
||||
wr_returned_time_sk ${type},
|
||||
wr_item_sk ${type},
|
||||
wr_refunded_customer_sk ${type},
|
||||
wr_refunded_cdemo_sk ${type},
|
||||
wr_refunded_hdemo_sk ${type},
|
||||
wr_refunded_addr_sk ${type},
|
||||
wr_returning_customer_sk ${type},
|
||||
wr_returning_cdemo_sk ${type},
|
||||
wr_returning_hdemo_sk ${type},
|
||||
wr_returning_addr_sk ${type},
|
||||
wr_web_page_sk ${type},
|
||||
wr_reason_sk ${type},
|
||||
wr_order_number ${type},
|
||||
wr_return_quantity ${type},
|
||||
wr_return_amt ${type},
|
||||
wr_return_tax ${type},
|
||||
wr_return_amt_inc_tax ${type},
|
||||
wr_fee ${type},
|
||||
wr_return_ship_cost ${type},
|
||||
wr_refunded_cash ${type},
|
||||
wr_reversed_charge ${type},
|
||||
wr_account_credit ${type},
|
||||
wr_net_loss ${type}
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE web_page(
|
||||
wp_web_page_sk ${type},
|
||||
wp_web_page_id VARCHAR,
|
||||
wp_rec_start_date DATE,
|
||||
wp_rec_end_date DATE,
|
||||
wp_creation_date_sk ${type},
|
||||
wp_access_date_sk ${type},
|
||||
wp_autogen_flag VARCHAR,
|
||||
wp_customer_sk ${type},
|
||||
wp_url VARCHAR,
|
||||
wp_type VARCHAR,
|
||||
wp_char_count ${type},
|
||||
wp_link_count ${type},
|
||||
wp_image_count ${type},
|
||||
wp_max_ad_count ${type}
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE warehouse(
|
||||
w_warehouse_sk ${type},
|
||||
w_warehouse_id VARCHAR,
|
||||
w_warehouse_name VARCHAR,
|
||||
w_warehouse_sq_ft ${type},
|
||||
w_street_number VARCHAR,
|
||||
w_street_name VARCHAR,
|
||||
w_street_type VARCHAR,
|
||||
w_suite_number VARCHAR,
|
||||
w_city VARCHAR,
|
||||
w_county VARCHAR,
|
||||
w_state VARCHAR,
|
||||
w_zip VARCHAR,
|
||||
w_country VARCHAR,
|
||||
w_gmt_offset ${type}
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE time_dim(
|
||||
t_time_sk ${type},
|
||||
t_time_id VARCHAR,
|
||||
t_time ${type},
|
||||
t_hour ${type},
|
||||
t_minute ${type},
|
||||
t_second ${type},
|
||||
t_am_pm VARCHAR,
|
||||
t_shift VARCHAR,
|
||||
t_sub_shift VARCHAR,
|
||||
t_meal_time VARCHAR
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE store_sales(
|
||||
ss_sold_date_sk ${type},
|
||||
ss_sold_time_sk ${type},
|
||||
ss_item_sk ${type},
|
||||
ss_customer_sk ${type},
|
||||
ss_cdemo_sk ${type},
|
||||
ss_hdemo_sk ${type},
|
||||
ss_addr_sk ${type},
|
||||
ss_store_sk ${type},
|
||||
ss_promo_sk ${type},
|
||||
ss_ticket_number ${type},
|
||||
ss_quantity ${type},
|
||||
ss_wholesale_cost ${type},
|
||||
ss_list_price ${type},
|
||||
ss_sales_price ${type},
|
||||
ss_ext_discount_amt ${type},
|
||||
ss_ext_sales_price ${type},
|
||||
ss_ext_wholesale_cost ${type},
|
||||
ss_ext_list_price ${type},
|
||||
ss_ext_tax ${type},
|
||||
ss_coupon_amt ${type},
|
||||
ss_net_paid ${type},
|
||||
ss_net_paid_inc_tax ${type},
|
||||
ss_net_profit ${type}
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE store_returns(
|
||||
sr_returned_date_sk ${type},
|
||||
sr_return_time_sk ${type},
|
||||
sr_item_sk ${type},
|
||||
sr_customer_sk ${type},
|
||||
sr_cdemo_sk ${type},
|
||||
sr_hdemo_sk ${type},
|
||||
sr_addr_sk ${type},
|
||||
sr_store_sk ${type},
|
||||
sr_reason_sk ${type},
|
||||
sr_ticket_number ${type},
|
||||
sr_return_quantity ${type},
|
||||
sr_return_amt ${type},
|
||||
sr_return_tax ${type},
|
||||
sr_return_amt_inc_tax ${type},
|
||||
sr_fee ${type},
|
||||
sr_return_ship_cost ${type},
|
||||
sr_refunded_cash ${type},
|
||||
sr_reversed_charge ${type},
|
||||
sr_store_credit ${type},
|
||||
sr_net_loss ${type}
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE store(
|
||||
s_store_sk ${type},
|
||||
s_store_id VARCHAR,
|
||||
s_rec_start_date DATE,
|
||||
s_rec_end_date DATE,
|
||||
s_closed_date_sk ${type},
|
||||
s_store_name VARCHAR,
|
||||
s_number_employees ${type},
|
||||
s_floor_space ${type},
|
||||
s_hours VARCHAR,
|
||||
s_manager VARCHAR,
|
||||
s_market_id ${type},
|
||||
s_geography_class VARCHAR,
|
||||
s_market_desc VARCHAR,
|
||||
s_market_manager VARCHAR,
|
||||
s_division_id ${type},
|
||||
s_division_name VARCHAR,
|
||||
s_company_id ${type},
|
||||
s_company_name VARCHAR,
|
||||
s_street_number VARCHAR,
|
||||
s_street_name VARCHAR,
|
||||
s_street_type VARCHAR,
|
||||
s_suite_number VARCHAR,
|
||||
s_city VARCHAR,
|
||||
s_county VARCHAR,
|
||||
s_state VARCHAR,
|
||||
s_zip VARCHAR,
|
||||
s_country VARCHAR,
|
||||
s_gmt_offset ${type},
|
||||
s_tax_percentage ${type}
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE ship_mode(
|
||||
sm_ship_mode_sk ${type},
|
||||
sm_ship_mode_id VARCHAR,
|
||||
sm_type VARCHAR,
|
||||
sm_code VARCHAR,
|
||||
sm_carrier VARCHAR,
|
||||
sm_contract VARCHAR
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE reason(
|
||||
r_reason_sk ${type},
|
||||
r_reason_id VARCHAR,
|
||||
r_reason_desc VARCHAR
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE promotion(
|
||||
p_promo_sk ${type},
|
||||
p_promo_id VARCHAR,
|
||||
p_start_date_sk ${type},
|
||||
p_end_date_sk ${type},
|
||||
p_item_sk ${type},
|
||||
p_cost ${type},
|
||||
p_response_target ${type},
|
||||
p_promo_name VARCHAR,
|
||||
p_channel_dmail VARCHAR,
|
||||
p_channel_email VARCHAR,
|
||||
p_channel_catalog VARCHAR,
|
||||
p_channel_tv VARCHAR,
|
||||
p_channel_radio VARCHAR,
|
||||
p_channel_press VARCHAR,
|
||||
p_channel_event VARCHAR,
|
||||
p_channel_demo VARCHAR,
|
||||
p_channel_details VARCHAR,
|
||||
p_purpose VARCHAR,
|
||||
p_discount_active VARCHAR
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE item(
|
||||
i_item_sk ${type},
|
||||
i_item_id VARCHAR,
|
||||
i_rec_start_date DATE,
|
||||
i_rec_end_date DATE,
|
||||
i_item_desc VARCHAR,
|
||||
i_current_price ${type},
|
||||
i_wholesale_cost ${type},
|
||||
i_brand_id ${type},
|
||||
i_brand VARCHAR,
|
||||
i_class_id ${type},
|
||||
i_class VARCHAR,
|
||||
i_category_id ${type},
|
||||
i_category VARCHAR,
|
||||
i_manufact_id ${type},
|
||||
i_manufact VARCHAR,
|
||||
i_size VARCHAR,
|
||||
i_formulation VARCHAR,
|
||||
i_color VARCHAR,
|
||||
i_units VARCHAR,
|
||||
i_container VARCHAR,
|
||||
i_manager_id ${type},
|
||||
i_product_name VARCHAR
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE inventory(
|
||||
inv_date_sk ${type},
|
||||
inv_item_sk ${type},
|
||||
inv_warehouse_sk ${type},
|
||||
inv_quantity_on_hand ${type}
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE income_band(
|
||||
ib_income_band_sk ${type},
|
||||
ib_lower_bound ${type},
|
||||
ib_upper_bound ${type}
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE household_demographics(
|
||||
hd_demo_sk ${type},
|
||||
hd_income_band_sk ${type},
|
||||
hd_buy_potential VARCHAR,
|
||||
hd_dep_count ${type},
|
||||
hd_vehicle_count ${type}
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE date_dim(
|
||||
d_date_sk ${type},
|
||||
d_date_id VARCHAR,
|
||||
d_date DATE,
|
||||
d_month_seq ${type},
|
||||
d_week_seq ${type},
|
||||
d_quarter_seq ${type},
|
||||
d_year ${type},
|
||||
d_dow ${type},
|
||||
d_moy ${type},
|
||||
d_dom ${type},
|
||||
d_qoy ${type},
|
||||
d_fy_year ${type},
|
||||
d_fy_quarter_seq ${type},
|
||||
d_fy_week_seq ${type},
|
||||
d_day_name VARCHAR,
|
||||
d_quarter_name VARCHAR,
|
||||
d_holiday VARCHAR,
|
||||
d_weekend VARCHAR,
|
||||
d_following_holiday VARCHAR,
|
||||
d_first_dom ${type},
|
||||
d_last_dom ${type},
|
||||
d_same_day_ly ${type},
|
||||
d_same_day_lq ${type},
|
||||
d_current_day VARCHAR,
|
||||
d_current_week VARCHAR,
|
||||
d_current_month VARCHAR,
|
||||
d_current_quarter VARCHAR,
|
||||
d_current_year VARCHAR
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE customer_demographics(
|
||||
cd_demo_sk ${type},
|
||||
cd_gender VARCHAR,
|
||||
cd_marital_status VARCHAR,
|
||||
cd_education_status VARCHAR,
|
||||
cd_purchase_estimate ${type},
|
||||
cd_credit_rating VARCHAR,
|
||||
cd_dep_count ${type},
|
||||
cd_dep_employed_count ${type},
|
||||
cd_dep_college_count ${type}
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE customer_address(
|
||||
ca_address_sk ${type},
|
||||
ca_address_id VARCHAR,
|
||||
ca_street_number VARCHAR,
|
||||
ca_street_name VARCHAR,
|
||||
ca_street_type VARCHAR,
|
||||
ca_suite_number VARCHAR,
|
||||
ca_city VARCHAR,
|
||||
ca_county VARCHAR,
|
||||
ca_state VARCHAR,
|
||||
ca_zip VARCHAR,
|
||||
ca_country VARCHAR,
|
||||
ca_gmt_offset ${type},
|
||||
ca_location_type VARCHAR
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE customer(
|
||||
c_customer_sk ${type},
|
||||
c_customer_id VARCHAR,
|
||||
c_current_cdemo_sk ${type},
|
||||
c_current_hdemo_sk ${type},
|
||||
c_current_addr_sk ${type},
|
||||
c_first_shipto_date_sk ${type},
|
||||
c_first_sales_date_sk ${type},
|
||||
c_salutation VARCHAR,
|
||||
c_first_name VARCHAR,
|
||||
c_last_name VARCHAR,
|
||||
c_preferred_cust_flag VARCHAR,
|
||||
c_birth_day ${type},
|
||||
c_birth_month ${type},
|
||||
c_birth_year ${type},
|
||||
c_birth_country VARCHAR,
|
||||
c_login VARCHAR,
|
||||
c_email_address VARCHAR,
|
||||
c_last_review_date_sk ${type}
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE catalog_sales(
|
||||
cs_sold_date_sk ${type},
|
||||
cs_sold_time_sk ${type},
|
||||
cs_ship_date_sk ${type},
|
||||
cs_bill_customer_sk ${type},
|
||||
cs_bill_cdemo_sk ${type},
|
||||
cs_bill_hdemo_sk ${type},
|
||||
cs_bill_addr_sk ${type},
|
||||
cs_ship_customer_sk ${type},
|
||||
cs_ship_cdemo_sk ${type},
|
||||
cs_ship_hdemo_sk ${type},
|
||||
cs_ship_addr_sk ${type},
|
||||
cs_call_center_sk ${type},
|
||||
cs_catalog_page_sk ${type},
|
||||
cs_ship_mode_sk ${type},
|
||||
cs_warehouse_sk ${type},
|
||||
cs_item_sk ${type},
|
||||
cs_promo_sk ${type},
|
||||
cs_order_number ${type},
|
||||
cs_quantity ${type},
|
||||
cs_wholesale_cost ${type},
|
||||
cs_list_price ${type},
|
||||
cs_sales_price ${type},
|
||||
cs_ext_discount_amt ${type},
|
||||
cs_ext_sales_price ${type},
|
||||
cs_ext_wholesale_cost ${type},
|
||||
cs_ext_list_price ${type},
|
||||
cs_ext_tax ${type},
|
||||
cs_coupon_amt ${type},
|
||||
cs_ext_ship_cost ${type},
|
||||
cs_net_paid ${type},
|
||||
cs_net_paid_inc_tax ${type},
|
||||
cs_net_paid_inc_ship ${type},
|
||||
cs_net_paid_inc_ship_tax ${type},
|
||||
cs_net_profit ${type}
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE catalog_returns(
|
||||
cr_returned_date_sk ${type},
|
||||
cr_returned_time_sk ${type},
|
||||
cr_item_sk ${type},
|
||||
cr_refunded_customer_sk ${type},
|
||||
cr_refunded_cdemo_sk ${type},
|
||||
cr_refunded_hdemo_sk ${type},
|
||||
cr_refunded_addr_sk ${type},
|
||||
cr_returning_customer_sk ${type},
|
||||
cr_returning_cdemo_sk ${type},
|
||||
cr_returning_hdemo_sk ${type},
|
||||
cr_returning_addr_sk ${type},
|
||||
cr_call_center_sk ${type},
|
||||
cr_catalog_page_sk ${type},
|
||||
cr_ship_mode_sk ${type},
|
||||
cr_warehouse_sk ${type},
|
||||
cr_reason_sk ${type},
|
||||
cr_order_number ${type},
|
||||
cr_return_quantity ${type},
|
||||
cr_return_amount ${type},
|
||||
cr_return_tax ${type},
|
||||
cr_return_amt_inc_tax ${type},
|
||||
cr_fee ${type},
|
||||
cr_return_ship_cost ${type},
|
||||
cr_refunded_cash ${type},
|
||||
cr_reversed_charge ${type},
|
||||
cr_store_credit ${type},
|
||||
cr_net_loss ${type}
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE catalog_page(
|
||||
cp_catalog_page_sk ${type},
|
||||
cp_catalog_page_id VARCHAR,
|
||||
cp_start_date_sk ${type},
|
||||
cp_end_date_sk ${type},
|
||||
cp_department VARCHAR,
|
||||
cp_catalog_number ${type},
|
||||
cp_catalog_page_number ${type},
|
||||
cp_description VARCHAR,
|
||||
cp_type VARCHAR
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE call_center(
|
||||
cc_call_center_sk ${type},
|
||||
cc_call_center_id VARCHAR,
|
||||
cc_rec_start_date DATE,
|
||||
cc_rec_end_date DATE,
|
||||
cc_closed_date_sk ${type},
|
||||
cc_open_date_sk ${type},
|
||||
cc_name VARCHAR,
|
||||
cc_class VARCHAR,
|
||||
cc_employees ${type},
|
||||
cc_sq_ft ${type},
|
||||
cc_hours VARCHAR,
|
||||
cc_manager VARCHAR,
|
||||
cc_mkt_id ${type},
|
||||
cc_mkt_class VARCHAR,
|
||||
cc_mkt_desc VARCHAR,
|
||||
cc_market_manager VARCHAR,
|
||||
cc_division ${type},
|
||||
cc_division_name VARCHAR,
|
||||
cc_company ${type},
|
||||
cc_company_name VARCHAR,
|
||||
cc_street_number VARCHAR,
|
||||
cc_street_name VARCHAR,
|
||||
cc_street_type VARCHAR,
|
||||
cc_suite_number VARCHAR,
|
||||
cc_city VARCHAR,
|
||||
cc_county VARCHAR,
|
||||
cc_state VARCHAR,
|
||||
cc_zip VARCHAR,
|
||||
cc_country VARCHAR,
|
||||
cc_gmt_offset ${type},
|
||||
cc_tax_percentage ${type}
|
||||
);
|
||||
|
||||
# Populate tables
|
||||
|
||||
statement ok
|
||||
insert into web_site select * from web_site_original;
|
||||
|
||||
statement ok
|
||||
insert into web_sales select * from web_sales_original;
|
||||
|
||||
statement ok
|
||||
insert into web_returns select * from web_returns_original;
|
||||
|
||||
statement ok
|
||||
insert into web_page select * from web_page_original;
|
||||
|
||||
statement ok
|
||||
insert into warehouse select * from warehouse_original;
|
||||
|
||||
statement ok
|
||||
insert into time_dim select * from time_dim_original;
|
||||
|
||||
statement ok
|
||||
insert into store_sales select * from store_sales_original;
|
||||
|
||||
statement ok
|
||||
insert into store_returns select * from store_returns_original;
|
||||
|
||||
statement ok
|
||||
insert into store select * from store_original;
|
||||
|
||||
statement ok
|
||||
insert into ship_mode select * from ship_mode_original;
|
||||
|
||||
statement ok
|
||||
insert into reason select * from reason_original;
|
||||
|
||||
statement ok
|
||||
insert into promotion select * from promotion_original;
|
||||
|
||||
statement ok
|
||||
insert into item select * from item_original;
|
||||
|
||||
statement ok
|
||||
insert into inventory select * from inventory_original;
|
||||
|
||||
statement ok
|
||||
insert into income_band select * from income_band_original;
|
||||
|
||||
statement ok
|
||||
insert into household_demographics select * from household_demographics_original;
|
||||
|
||||
statement ok
|
||||
insert into date_dim select * from date_dim_original;
|
||||
|
||||
statement ok
|
||||
insert into customer_demographics select * from customer_demographics_original;
|
||||
|
||||
statement ok
|
||||
insert into customer_address select * from customer_address_original;
|
||||
|
||||
statement ok
|
||||
insert into customer select * from customer_original;
|
||||
|
||||
statement ok
|
||||
insert into catalog_sales select * from catalog_sales_original;
|
||||
|
||||
statement ok
|
||||
insert into catalog_returns select * from catalog_returns_original;
|
||||
|
||||
statement ok
|
||||
insert into catalog_page select * from catalog_page_original;
|
||||
|
||||
statement ok
|
||||
insert into call_center select * from call_center_original;
|
||||
|
||||
# Checkpoint to compress the data
|
||||
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
# And verify that no other compression is used
|
||||
foreach tbl web_site web_sales web_returns web_page warehouse time_dim store_sales store_returns store ship_mode reason promotion item inventory income_band household_demographics date_dim customer_demographics customer_address customer catalog_sales catalog_returns catalog_page call_center
|
||||
|
||||
# Cant turn off the creation of constant segments, so we have to just accept that some of the segments are Constant
|
||||
query I
|
||||
SELECT compression FROM pragma_storage_info('${tbl}') WHERE segment_type == '${type}' AND compression != 'ALP' AND compression != 'Constant';
|
||||
----
|
||||
|
||||
endloop
|
||||
|
||||
# Run the tpcds queries
|
||||
|
||||
loop i 1 9
|
||||
|
||||
query I
|
||||
PRAGMA tpcds(${i})
|
||||
----
|
||||
<FILE>:extension/tpcds/dsdgen/answers/sf1/0${i}.csv
|
||||
|
||||
endloop
|
||||
|
||||
loop i 10 49
|
||||
|
||||
#Skip tpcds 49 because it doesn't work without decimals
|
||||
|
||||
query I
|
||||
PRAGMA tpcds(${i})
|
||||
----
|
||||
<FILE>:extension/tpcds/dsdgen/answers/sf1/${i}.csv
|
||||
|
||||
endloop
|
||||
|
||||
# skip tpcds 67 - inconsistent without decimals
|
||||
loop i 50 66
|
||||
|
||||
query I
|
||||
PRAGMA tpcds(${i})
|
||||
----
|
||||
<FILE>:extension/tpcds/dsdgen/answers/sf1/${i}.csv
|
||||
|
||||
endloop
|
||||
|
||||
loop i 68 99
|
||||
|
||||
query I
|
||||
PRAGMA tpcds(${i})
|
||||
----
|
||||
<FILE>:extension/tpcds/dsdgen/answers/sf1/${i}.csv
|
||||
|
||||
endloop
|
||||
|
||||
# Drop tables
|
||||
|
||||
statement ok
|
||||
DROP TABLE web_site;
|
||||
|
||||
statement ok
|
||||
DROP TABLE web_sales;
|
||||
|
||||
statement ok
|
||||
DROP TABLE web_returns;
|
||||
|
||||
statement ok
|
||||
DROP TABLE web_page;
|
||||
|
||||
statement ok
|
||||
DROP TABLE warehouse;
|
||||
|
||||
statement ok
|
||||
DROP TABLE time_dim;
|
||||
|
||||
statement ok
|
||||
DROP TABLE store_sales;
|
||||
|
||||
statement ok
|
||||
DROP TABLE store_returns;
|
||||
|
||||
statement ok
|
||||
DROP TABLE store;
|
||||
|
||||
statement ok
|
||||
DROP TABLE ship_mode;
|
||||
|
||||
statement ok
|
||||
DROP TABLE reason;
|
||||
|
||||
statement ok
|
||||
DROP TABLE promotion;
|
||||
|
||||
statement ok
|
||||
DROP TABLE item;
|
||||
|
||||
statement ok
|
||||
DROP TABLE inventory;
|
||||
|
||||
statement ok
|
||||
DROP TABLE income_band;
|
||||
|
||||
statement ok
|
||||
DROP TABLE household_demographics;
|
||||
|
||||
statement ok
|
||||
DROP TABLE date_dim;
|
||||
|
||||
statement ok
|
||||
DROP TABLE customer_demographics;
|
||||
|
||||
statement ok
|
||||
DROP TABLE customer_address;
|
||||
|
||||
statement ok
|
||||
DROP TABLE customer;
|
||||
|
||||
statement ok
|
||||
DROP TABLE catalog_sales;
|
||||
|
||||
statement ok
|
||||
DROP TABLE catalog_returns;
|
||||
|
||||
statement ok
|
||||
DROP TABLE catalog_page;
|
||||
|
||||
statement ok
|
||||
DROP TABLE call_center;
|
||||
|
||||
|
||||
endloop
|
||||
247
external/duckdb/test/sql/storage/compression/alp/alp_tpch.test_slow
vendored
Normal file
247
external/duckdb/test/sql/storage/compression/alp/alp_tpch.test_slow
vendored
Normal file
@@ -0,0 +1,247 @@
|
||||
# name: test/sql/storage/compression/alp/alp_tpch.test_slow
|
||||
# group: [alp]
|
||||
|
||||
require tpch
|
||||
|
||||
# load the DB from disk
|
||||
load __TEST_DIR__/test_alp.db
|
||||
|
||||
# This needs to be single-threaded to be consistent (because of floating point issues)
|
||||
statement ok
|
||||
pragma threads=1
|
||||
|
||||
statement ok
|
||||
PRAGMA force_compression='alp';
|
||||
|
||||
statement ok
|
||||
call dbgen(sf=1, suffix='_original');
|
||||
|
||||
# Test both DOUBLE and FLOAT
|
||||
|
||||
foreach type DOUBLE FLOAT
|
||||
|
||||
# Create tables
|
||||
|
||||
statement ok
|
||||
CREATE TABLE lineitem(
|
||||
l_orderkey ${type} NOT NULL,
|
||||
l_partkey ${type} NOT NULL,
|
||||
l_suppkey ${type} NOT NULL,
|
||||
l_linenumber ${type} NOT NULL,
|
||||
l_quantity ${type} NOT NULL,
|
||||
l_extendedprice ${type} NOT NULL,
|
||||
l_discount ${type} NOT NULL,
|
||||
l_tax ${type} NOT NULL,
|
||||
l_returnflag VARCHAR NOT NULL,
|
||||
l_linestatus VARCHAR NOT NULL,
|
||||
l_shipdate DATE NOT NULL,
|
||||
l_commitdate DATE NOT NULL,
|
||||
l_receiptdate DATE NOT NULL,
|
||||
l_shipinstruct VARCHAR NOT NULL,
|
||||
l_shipmode VARCHAR NOT NULL,
|
||||
l_comment VARCHAR NOT NULL
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE orders(
|
||||
o_orderkey ${type} NOT NULL,
|
||||
o_custkey ${type} NOT NULL,
|
||||
o_orderstatus VARCHAR NOT NULL,
|
||||
o_totalprice ${type} NOT NULL,
|
||||
o_orderdate DATE NOT NULL,
|
||||
o_orderpriority VARCHAR NOT NULL,
|
||||
o_clerk VARCHAR NOT NULL,
|
||||
o_shippriority ${type} NOT NULL,
|
||||
o_comment VARCHAR NOT NULL
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE partsupp(
|
||||
ps_partkey ${type} NOT NULL,
|
||||
ps_suppkey ${type} NOT NULL,
|
||||
ps_availqty ${type} NOT NULL,
|
||||
ps_supplycost ${type} NOT NULL,
|
||||
ps_comment VARCHAR NOT NULL
|
||||
);
|
||||
|
||||
# 'p_partkey' being INTEGER is imperative to TPCH(17)
|
||||
statement ok
|
||||
CREATE TABLE part(
|
||||
p_partkey INTEGER NOT NULL,
|
||||
p_name VARCHAR NOT NULL,
|
||||
p_mfgr VARCHAR NOT NULL,
|
||||
p_brand VARCHAR NOT NULL,
|
||||
p_type VARCHAR NOT NULL,
|
||||
p_size ${type} NOT NULL,
|
||||
p_container VARCHAR NOT NULL,
|
||||
p_retailprice ${type} NOT NULL,
|
||||
p_comment VARCHAR NOT NULL
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE customer(
|
||||
c_custkey ${type} NOT NULL,
|
||||
c_name VARCHAR NOT NULL,
|
||||
c_address VARCHAR NOT NULL,
|
||||
c_nationkey ${type} NOT NULL,
|
||||
c_phone VARCHAR NOT NULL,
|
||||
c_acctbal ${type} NOT NULL,
|
||||
c_mktsegment VARCHAR NOT NULL,
|
||||
c_comment VARCHAR NOT NULL
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE supplier(
|
||||
s_suppkey ${type} NOT NULL,
|
||||
s_name VARCHAR NOT NULL,
|
||||
s_address VARCHAR NOT NULL,
|
||||
s_nationkey ${type} NOT NULL,
|
||||
s_phone VARCHAR NOT NULL,
|
||||
s_acctbal ${type} NOT NULL,
|
||||
s_comment VARCHAR NOT NULL
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE nation(
|
||||
n_nationkey ${type} NOT NULL,
|
||||
n_name VARCHAR NOT NULL,
|
||||
n_regionkey ${type} NOT NULL,
|
||||
n_comment VARCHAR NOT NULL
|
||||
);
|
||||
|
||||
statement ok
|
||||
CREATE TABLE region(
|
||||
r_regionkey ${type} NOT NULL,
|
||||
r_name VARCHAR NOT NULL,
|
||||
r_comment VARCHAR NOT NULL
|
||||
);
|
||||
|
||||
# Populate tables
|
||||
|
||||
statement ok
|
||||
insert into lineitem select * from lineitem_original;
|
||||
|
||||
statement ok
|
||||
insert into orders select * from orders_original;
|
||||
|
||||
statement ok
|
||||
insert into partsupp select * from partsupp_original;
|
||||
|
||||
statement ok
|
||||
insert into part select * from part_original;
|
||||
|
||||
statement ok
|
||||
insert into customer select * from customer_original;
|
||||
|
||||
statement ok
|
||||
insert into supplier select * from supplier_original;
|
||||
|
||||
statement ok
|
||||
insert into nation select * from nation_original;
|
||||
|
||||
statement ok
|
||||
insert into region select * from region_original;
|
||||
|
||||
# Checkpoint to compress the data
|
||||
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
# Run the tpch queries
|
||||
|
||||
loop i 1 9
|
||||
|
||||
query I
|
||||
PRAGMA tpch(${i})
|
||||
----
|
||||
<FILE>:extension/tpch/dbgen/answers/sf1/q0${i}.csv
|
||||
|
||||
endloop
|
||||
|
||||
loop i 10 15
|
||||
|
||||
query I
|
||||
PRAGMA tpch(${i})
|
||||
----
|
||||
<FILE>:extension/tpch/dbgen/answers/sf1/q${i}.csv
|
||||
|
||||
endloop
|
||||
|
||||
#TPCH 15 - 'sum' replaced with 'kahan_sum'
|
||||
query I
|
||||
SELECT
|
||||
s_suppkey,
|
||||
s_name,
|
||||
s_address,
|
||||
s_phone,
|
||||
total_revenue
|
||||
FROM
|
||||
supplier,
|
||||
(
|
||||
SELECT
|
||||
l_suppkey AS supplier_no,
|
||||
kahan_sum(l_extendedprice * (1 - l_discount)) AS total_revenue
|
||||
FROM
|
||||
lineitem
|
||||
WHERE
|
||||
l_shipdate >= CAST('1996-01-01' AS date)
|
||||
AND l_shipdate < CAST('1996-04-01' AS date)
|
||||
GROUP BY
|
||||
supplier_no) revenue0
|
||||
WHERE
|
||||
s_suppkey = supplier_no
|
||||
AND total_revenue = (
|
||||
SELECT
|
||||
max(total_revenue)
|
||||
FROM (
|
||||
SELECT
|
||||
l_suppkey AS supplier_no,
|
||||
kahan_sum(l_extendedprice * (1 - l_discount)) AS total_revenue
|
||||
FROM
|
||||
lineitem
|
||||
WHERE
|
||||
l_shipdate >= CAST('1996-01-01' AS date)
|
||||
AND l_shipdate < CAST('1996-04-01' AS date)
|
||||
GROUP BY
|
||||
supplier_no) revenue1)
|
||||
ORDER BY
|
||||
s_suppkey;
|
||||
----
|
||||
<FILE>:extension/tpch/dbgen/answers/sf1/q15.csv
|
||||
|
||||
loop i 16 23
|
||||
|
||||
query I
|
||||
PRAGMA tpch(${i})
|
||||
----
|
||||
<FILE>:extension/tpch/dbgen/answers/sf1/q${i}.csv
|
||||
|
||||
endloop
|
||||
|
||||
# Drop tables
|
||||
|
||||
statement ok
|
||||
DROP TABLE lineitem;
|
||||
|
||||
statement ok
|
||||
DROP TABLE orders;
|
||||
|
||||
statement ok
|
||||
DROP TABLE partsupp;
|
||||
|
||||
statement ok
|
||||
DROP TABLE part;
|
||||
|
||||
statement ok
|
||||
DROP TABLE customer;
|
||||
|
||||
statement ok
|
||||
DROP TABLE supplier;
|
||||
|
||||
statement ok
|
||||
DROP TABLE nation;
|
||||
|
||||
statement ok
|
||||
DROP TABLE region;
|
||||
|
||||
endloop
|
||||
44
external/duckdb/test/sql/storage/compression/alp/alp_zeros.test
vendored
Normal file
44
external/duckdb/test/sql/storage/compression/alp/alp_zeros.test
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# name: test/sql/storage/compression/alp/alp_zeros.test
|
||||
# description: Test storage of alp, but simple
|
||||
# group: [alp]
|
||||
|
||||
# load the DB from disk
|
||||
load __TEST_DIR__/test_alp.db
|
||||
|
||||
statement ok
|
||||
PRAGMA force_compression='uncompressed'
|
||||
|
||||
# Create a table with random doubles of limited precision compressed as Uncompressed
|
||||
# This data should achieve x6 compression ratio
|
||||
statement ok
|
||||
create table random_double as select 0::DOUBLE as data from range(1024) tbl(i);
|
||||
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
query I
|
||||
SELECT compression FROM pragma_storage_info('random_double') WHERE segment_type == 'double' AND compression != 'Uncompressed';
|
||||
----
|
||||
|
||||
# Now create a duplicate of this table, compressed with ALP instead
|
||||
statement ok
|
||||
PRAGMA force_compression='alp'
|
||||
|
||||
statement ok
|
||||
create table random_alp_double as select * from random_double;
|
||||
|
||||
statement ok
|
||||
checkpoint
|
||||
|
||||
query I
|
||||
SELECT compression FROM pragma_storage_info('random_alp_double') WHERE segment_type == 'double' AND compression != 'ALP';
|
||||
----
|
||||
|
||||
# Assert that the data was not corrupted by compressing to ALP
|
||||
query I sort r1
|
||||
select * from random_double;
|
||||
----
|
||||
|
||||
query I sort r1
|
||||
select * from random_alp_double;
|
||||
----
|
||||
Reference in New Issue
Block a user