should be it

This commit is contained in:
2025-10-24 19:21:19 -05:00
parent a4b23fc57c
commit f09560c7b1
14047 changed files with 3161551 additions and 1 deletions

View File

@@ -0,0 +1,19 @@
# name: test/sql/tpch/dbgen_error.test
# description: Test error thrown during dbgen
# group: [tpch]
require tpch
statement ok
PRAGMA enable_verification
statement ok
SET memory_limit = '100MB';
statement ok
SET temp_directory = '.unrecognized_folder/folder2'
statement error
CALL dbgen(sf=1);
----
<REGEX>:.*IO Error.*Failed to create directory.*

View File

@@ -0,0 +1,32 @@
# name: test/sql/tpch/dbgen_readonly.test
# description: Test that dbgen respects read-only mode
# group: [tpch]
require tpch
require skip_reload
load __TEST_DIR__/test_dbgen_ro.db
statement ok
CREATE TABLE tbl (i INTEGER);
load __TEST_DIR__/test_dbgen_ro.db readonly
statement error
CALL dbgen(sf=0);
----
read-only
load
statement ok
ATTACH '__TEST_DIR__/test_dbgen_ro.db' AS dbgentest (READ_ONLY)
statement error
CALL dbgen(sf=0, catalog='dbgentest');
----
read-only
statement ok
CALL dbgen(sf=0);

View File

@@ -0,0 +1,30 @@
# name: test/sql/tpch/gzip_csv_auto_detect.test_slow
# description: Issue #7377 - DuckDB significantly exceeds memory_limit when ingesting .csv.gz file with sample_size=-1
# group: [tpch]
require tpch
statement ok
PRAGMA enable_verification
# write lineitem to lineitem.csv.gz
statement ok
CALL dbgen(sf=1);
statement ok
COPY lineitem TO '__TEST_DIR__/lineitem.csv.gz' (HEADER)
load __TEST_DIR__/store_tpch_auto_detect.db
# now read the gzip compressed file with sample_size=-1
statement ok
SET memory_limit='750MB';
statement ok
CREATE OR REPLACE TABLE lineitem AS (SELECT * FROM read_csv_auto(['__TEST_DIR__/lineitem.csv.gz'], sample_size=-1));
# run Q01 to verify the file was loaded correctly
query I
PRAGMA tpch(1)
----
<FILE>:extension/tpch/dbgen/answers/sf1/q01.csv

View File

@@ -0,0 +1,30 @@
# name: test/sql/tpch/q01_positional.test_slow
# description: Test positional join decomposition in Q01
# group: [tpch]
require tpch
statement ok
CALL dbgen(sf=1, suffix='_positional');
statement ok
CREATE VIEW lineitem AS (SELECT * FROM
(SELECT l_returnflag FROM lineitem_positional)
POSITIONAL JOIN
(SELECT l_linestatus FROM lineitem_positional)
POSITIONAL JOIN
(SELECT l_quantity FROM lineitem_positional)
POSITIONAL JOIN
(SELECT l_extendedprice FROM lineitem_positional)
POSITIONAL JOIN
(SELECT l_discount FROM lineitem_positional)
POSITIONAL JOIN
(SELECT l_tax FROM lineitem_positional)
POSITIONAL JOIN
(SELECT l_shipdate FROM lineitem_positional)
)
query I
PRAGMA tpch(1)
----
<FILE>:extension/tpch/dbgen/answers/sf1/q01.csv

View File

@@ -0,0 +1,28 @@
# name: test/sql/tpch/q01_propagate.test_slow
# description: Test statistics propagation in Q01
# group: [tpch]
require tpch
statement ok
CALL dbgen(sf=0.01);
query I
SELECT stats(1 - l_discount) FROM lineitem LIMIT 1;
----
<REGEX>:.*0.90.*1.00.*
query I
SELECT stats(1 + l_tax) FROM lineitem LIMIT 1;
----
<REGEX>:.*1.00.*1.08.*
query I
SELECT stats(l_extendedprice * (1 - l_discount)) FROM lineitem LIMIT 1;
----
<REGEX>:.*813.6000.*94949.5000.*
query I
SELECT stats(l_extendedprice * (1 - l_discount) * (1 + l_tax)) FROM lineitem LIMIT 1;
----
<REGEX>:.*813.600000.*102545.460000.*

View File

@@ -0,0 +1,70 @@
# name: test/sql/tpch/q01_union.test_slow
# description: Test TPC-H SF0.01 Q1 with unions
# group: [tpch]
require tpch
statement ok
PRAGMA threads=4
statement ok
PRAGMA verify_parallelism
statement ok
CALL dbgen(sf=0.01);
query IIIII
SELECT
l_returnflag,
l_linestatus,
sum(l_quantity) AS sum_qty,
sum(l_extendedprice) AS sum_base_price,
sum(l_extendedprice * (1 - l_discount)) AS sum_disc_price,
sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge,
avg(l_quantity) AS avg_qty,
avg(l_extendedprice) AS avg_price,
avg(l_discount) AS avg_disc,
count(*) AS count_order
FROM
(
SELECT * FROM lineitem WHERE l_shipdate <= DATE '1990-09-02'
UNION ALL
SELECT * FROM lineitem WHERE l_shipdate > DATE '1990-09-02' AND l_shipdate <= DATE '1992-09-02'
UNION ALL
SELECT * FROM lineitem WHERE l_shipdate > DATE '1992-09-02' AND l_shipdate <= DATE '1994-09-02'
UNION ALL
SELECT * FROM lineitem WHERE l_shipdate > DATE '1994-09-02' AND l_shipdate <= DATE '1996-09-02'
UNION ALL
SELECT * FROM lineitem WHERE l_shipdate > DATE '1996-09-02' AND l_shipdate <= DATE '1998-09-02'
) lineitem
GROUP BY
l_returnflag,
l_linestatus
ORDER BY
l_returnflag,
l_linestatus;
----
<FILE>:extension/tpch/dbgen/answers/sf0.01/q01.csv
query I
SELECT sum(l_quantity) AS sum FROM lineitem WHERE l_shipdate <= CAST('1998-09-02' AS date)
UNION ALL
SELECT sum(l_extendedprice) FROM lineitem WHERE l_shipdate <= CAST('1998-09-02' AS date)
UNION ALL
SELECT sum(l_extendedprice * (1 - l_discount)) FROM lineitem WHERE l_shipdate <= CAST('1998-09-02' AS date)
UNION ALL
SELECT sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) FROM lineitem WHERE l_shipdate <= CAST('1998-09-02' AS date)
UNION ALL
SELECT avg(l_quantity) FROM lineitem WHERE l_shipdate <= CAST('1998-09-02' AS date)
UNION ALL
SELECT avg(l_extendedprice) FROM lineitem WHERE l_shipdate <= CAST('1998-09-02' AS date)
UNION ALL
SELECT count(*) FROM lineitem WHERE l_shipdate <= CAST('1998-09-02' AS date)
----
1513678.0
2120830299.82
2015354671.73
2096391169.94
25.522754480921307
35760.20199672889
59307.0

View File

@@ -0,0 +1,184 @@
# name: test/sql/tpch/test_tpch_options.test_slow
# description: Test TPC-H Generator Options
# group: [tpch]
require tpch
#Test wrong parameters
statement error
CALL dbgen(sf=0.01, children=-1);
----
Invalid Input Error: Failed to cast value: Type INT32 with value -1 can't be cast because the value is out of range for the destination type UINT32
statement error
CALL dbgen(sf=0.01, children=2);
----
Step must be defined when children are defined
statement error
call dbgen(sf=NULL);
----
<REGEX>:.*Cannot use NULL.*
statement error
call dbgen(sf=1, catalog=NULL);
----
<REGEX>:.*Cannot use NULL.*
statement ok
CALL dbgen(sf=1, children =100, step = 0);
query IIII
select * from nation
----
0 ALGERIA 0 furiously regular requests. platelets affix furious
query I
select count(*) from lineitem
----
60175
query I
select count(*) from orders
----
15000
query I
select count(*) from customer
----
1500
query I
select count(*) from part
----
2000
query I
select count(*) from partsupp
----
8000
query I
select count(*) from region
----
1
query I
select count(*) from supplier
----
100
statement ok
CALL dbgen(sf=1, children =100, step = 1);
query III
select n_nationkey, n_name, n_regionkey from nation
----
0 ALGERIA 0
1 ARGENTINA 1
loop i 2 50
statement ok
CALL dbgen(sf=1, children =100, step = ${i});
endloop
query III
select n_nationkey, n_name, n_regionkey from nation
----
0 ALGERIA 0
1 ARGENTINA 1
2 BRAZIL 1
3 CANADA 1
4 EGYPT 4
5 ETHIOPIA 0
6 FRANCE 3
7 GERMANY 3
8 INDIA 2
9 INDONESIA 2
10 IRAN 4
11 IRAQ 4
12 JAPAN 2
13 JORDAN 4
14 KENYA 0
15 MOROCCO 0
16 MOZAMBIQUE 0
17 PERU 1
18 CHINA 2
19 ROMANIA 3
20 SAUDI ARABIA 4
21 VIETNAM 2
22 RUSSIA 3
23 UNITED KINGDOM 3
24 UNITED STATES 1
# Loop through the number of children
loop i 50 110
statement ok
CALL dbgen(sf=1, children =100, step = ${i});
endloop
statement ok
CALL dbgen(sf=1, suffix='_og');
foreach tpch_tbl orders customer lineitem nation part partsupp region supplier
query I
select count(*) from (SELECT * FROM ${tpch_tbl} EXCEPT SELECT * FROM ${tpch_tbl}_og);
----
0
query I
select count (*) from (SELECT * FROM ${tpch_tbl}_og EXCEPT SELECT * FROM ${tpch_tbl});
----
0
endloop
statement ok
ATTACH DATABASE ':memory:' AS db1;
statement ok
CALL dbgen(sf=1, catalog='db1');
foreach tpch_tbl orders customer lineitem nation part partsupp region supplier
query I
select count(*) from (SELECT * FROM ${tpch_tbl} EXCEPT SELECT * FROM db1.${tpch_tbl});
----
0
query I
select count (*) from (SELECT * FROM db1.${tpch_tbl} EXCEPT SELECT * FROM ${tpch_tbl});
----
0
endloop
statement ok
CREATE SCHEMA db1.test_schema
statement ok
CALL dbgen(sf=1, catalog='db1', schema='test_schema');
foreach tpch_tbl orders customer lineitem nation part partsupp region supplier
query I
select count(*) from (SELECT * FROM ${tpch_tbl} EXCEPT SELECT * FROM db1.test_schema.${tpch_tbl});
----
0
query I
select count (*) from (SELECT * FROM db1.test_schema.${tpch_tbl} EXCEPT SELECT * FROM ${tpch_tbl});
----
0
endloop

View File

@@ -0,0 +1,35 @@
# name: test/sql/tpch/tpch_floating_point_join.test_slow
# description: Join using floating point keys
# group: [tpch]
require tpch
statement ok
CALL dbgen(sf=0.1, suffix='_normal');
statement ok
CREATE TABLE lineitem_flt AS SELECT * REPLACE (l_orderkey::DOUBLE AS l_orderkey) FROM lineitem_normal;
statement ok
CREATE TABLE orders_flt AS SELECT * REPLACE (o_orderkey::DOUBLE AS o_orderkey) FROM orders_normal;
statement ok
CREATE TABLE lineitem_dbl AS SELECT * REPLACE (l_orderkey::DOUBLE AS l_orderkey) FROM lineitem_normal;
statement ok
CREATE TABLE orders_dbl AS SELECT * REPLACE (o_orderkey::DOUBLE AS o_orderkey) FROM orders_normal;
query I
SELECT COUNT(*) from lineitem_normal join orders_normal on (l_orderkey=o_orderkey);
----
600572
query I
SELECT COUNT(*) from lineitem_dbl join orders_dbl on (l_orderkey=o_orderkey);
----
600572
query I
SELECT COUNT(*) from lineitem_flt join orders_flt on (l_orderkey=o_orderkey);
----
600572

View File

@@ -0,0 +1,45 @@
# name: test/sql/tpch/tpch_grouping_sets.test_slow
# description: Test TPC-H SF0.01 Q1 with unions
# group: [tpch]
require tpch
statement ok
PRAGMA threads=4
statement ok
PRAGMA verify_parallelism
statement ok
CALL dbgen(sf=0.1);
query IIIIIIIIII
SELECT
l_returnflag,
l_linestatus,
sum(l_quantity) AS sum_qty,
sum(l_extendedprice) AS sum_base_price,
sum(l_extendedprice * (1 - l_discount)) AS sum_disc_price,
sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge,
avg(l_quantity) AS avg_qty,
avg(l_extendedprice) AS avg_price,
avg(l_discount) AS avg_disc,
count(*) AS count_order
FROM
lineitem
GROUP BY
GROUPING SETS ((l_returnflag, l_linestatus), (l_returnflag), (l_linestatus), ())
ORDER BY
l_returnflag NULLS LAST,
l_linestatus NULLS LAST;
----
A F 3774200 5320753880.69 5054096266.6828 5256751331.449234 25.5375871168549970 36002.123829014142 0.05014459706340077136 147790
A NULL 3774200 5320753880.69 5054096266.6828 5256751331.449234 25.5375871168549970 36002.123829014142 0.05014459706340077136 147790
N F 95257 133737795.84 127132372.6512 132286291.229445 25.3006640106241700 35521.326916334661 0.04939442231075697211 3765
N O 7679822 10823487077.24 10282025059.1390 10693158047.350890 25.5384548876680988 35992.388423761955 0.05008945317176339137 300716
N NULL 7775079 10957224873.08 10409157431.7902 10825444338.580335 25.5355145312843823 35986.563605216746 0.05008085890416807617 304481
R F 3785523 5337950526.47 5071818532.9420 5274405503.049367 25.5259438574251017 35994.029214030924 0.04998927856184381764 148301
R NULL 3785523 5337950526.47 5071818532.9420 5274405503.049367 25.5259438574251017 35994.029214030924 0.04998927856184381764 148301
NULL F 7654980 10792442203.00 10253047172.2760 10663443125.728046 25.5288538498479270 35992.083543434182 0.05005836134677978763 299856
NULL O 7679822 10823487077.24 10282025059.1390 10693158047.350890 25.5384548876680988 35992.388423761955 0.05008945317176339137 300716
NULL NULL 15334802 21615929280.24 20535072231.4150 21356601173.078936 25.5336612429483892 35992.236201887534 0.05007392952052376734 600572

View File

@@ -0,0 +1,65 @@
# name: test/sql/tpch/tpch_hive_partition.test_slow
# description: Test TPC-H SF1 over hive partitions
# group: [tpch]
require parquet
require tpch
statement ok
CALL dbgen(sf=1);
statement ok
COPY lineitem TO '__TEST_DIR__/lineitem_aggregate_partitioned' (FORMAT parquet, PARTITION_BY (l_returnflag, l_linestatus));
statement ok
DROP TABLE lineitem
statement ok
CREATE VIEW lineitem AS FROM '__TEST_DIR__/lineitem_aggregate_partitioned/**/*.parquet'
query I
PRAGMA tpch(1)
----
<FILE>:extension/tpch/dbgen/answers/sf1/q01.csv
query III
SELECT COUNT(*), SUM(l_extendedprice), l_returnflag
FROM lineitem
GROUP BY ALL
ORDER BY ALL
----
1478493 56586554400.73 A
1478870 56568041380.90 R
3043852 116422715119.57 N
query III
SELECT COUNT(*), SUM(l_extendedprice), l_returnflag
FROM lineitem
WHERE l_linestatus='O'
GROUP BY ALL
ORDER BY ALL
----
3004998 114935210409.19 N
query III
SELECT COUNT(*), SUM(l_extendedprice), l_linestatus
FROM lineitem
GROUP BY ALL
ORDER BY ALL
----
2996217 114642100492.01 F
3004998 114935210409.19 O
statement ok
SET parquet_metadata_cache=true
query I
select count(*) from lineitem
----
6001215
query I
select count(*) from lineitem
----
6001215

View File

@@ -0,0 +1,75 @@
# name: test/sql/tpch/tpch_like.test_slow
# description: Test LIKE statement on TPC-H
# group: [tpch]
require tpch
statement ok
PRAGMA enable_verification
statement ok
CALL dbgen(sf=0.1)
# LIKE
query I
SELECT COUNT(*) FROM lineitem WHERE l_comment LIKE '%horse%'
----
1262
query I
SELECT COUNT(*) FROM lineitem WHERE l_comment LIKE 'horse%'
----
50
query I
SELECT COUNT(*) FROM lineitem WHERE l_comment LIKE '%horse'
----
50
# with underscore
query I
SELECT COUNT(*) FROM lineitem WHERE l_comment LIKE '%h_rse%'
----
1262
query I
SELECT COUNT(*) FROM lineitem WHERE l_comment LIKE 'h_rse%'
----
50
query I
SELECT COUNT(*) FROM lineitem WHERE l_comment LIKE '%h_rse'
----
50
# NOT LIKE
query I
SELECT COUNT(*) FROM lineitem WHERE l_comment NOT LIKE '%a%'
----
105580
query I
SELECT COUNT(*) FROM lineitem WHERE l_comment NOT LIKE 'h%'
----
588270
query I
SELECT COUNT(*) FROM lineitem WHERE l_comment NOT LIKE '%a'
----
563861
# with underscore
query I
SELECT COUNT(*) FROM lineitem WHERE l_comment NOT LIKE '%a_%'
----
114512
query I
SELECT COUNT(*) FROM lineitem WHERE l_comment NOT LIKE 'a_%'
----
563657
query I
SELECT COUNT(*) FROM lineitem WHERE l_comment NOT LIKE '%_a'
----
563861

View File

@@ -0,0 +1,16 @@
# name: test/sql/tpch/tpch_limit_offset.test_slow
# description: Test large limit + offset queries on TPC-H
# group: [tpch]
require tpch
statement ok
PRAGMA enable_verification
statement ok
CALL dbgen(sf=1);
query IIIIIIIIIIIIIIII
SELECT MAX(COLUMNS(*)) FROM (FROM lineitem LIMIT 100000 OFFSET 5000000)
----
5099235 199996 10000 7 50.00 104649.50 0.10 0.08 R O 1998-11-30 1998-10-30 1998-12-22 TAKE BACK RETURN TRUCK zzle. express, bold deposits was. slyly e

View File

@@ -0,0 +1,32 @@
# name: test/sql/tpch/tpch_parallel_sf01.test_slow
# description: Test parallel TPC-H SF0.1
# group: [tpch]
require tpch
statement ok
PRAGMA threads=4
statement ok
PRAGMA verify_parallelism
statement ok
CALL dbgen(sf=0.1);
loop i 1 9
query I
PRAGMA tpch(${i})
----
<FILE>:extension/tpch/dbgen/answers/sf0.1/q0${i}.csv
endloop
loop i 10 23
query I
PRAGMA tpch(${i})
----
<FILE>:extension/tpch/dbgen/answers/sf0.1/q${i}.csv
endloop

View File

@@ -0,0 +1,27 @@
# name: test/sql/tpch/tpch_partial_scheduling.test_slow
# description: Test TPC-H SF1 while running all queries at oncem
# group: [tpch]
require tpch
statement ok
CALL dbgen(sf=1);
statement ok
SET scheduler_process_partial=true;
concurrentloop i 1 23
onlyif i<=9
query I
PRAGMA tpch(${i})
----
<FILE>:extension/tpch/dbgen/answers/sf1/q0${i}.csv
onlyif i>=10
query I
PRAGMA tpch(${i})
----
<FILE>:extension/tpch/dbgen/answers/sf1/q${i}.csv
endloop

View File

@@ -0,0 +1,70 @@
# name: test/sql/tpch/tpch_power_test.test_slow
# description: Test TPC-H power test
# group: [tpch]
# TPC-H power test
mode skip
require parquet
require tpch
statement ok
ATTACH '/Users/myth/Programs/duckdb-tpch-power-test/gen/sf100/tpch.duckdb' AS tpch
statement ok
USE tpch
statement ok
SELECT COUNT(*) FROM lineitem
statement ok
SET wal_autocheckpoint='100MB'
mode output_result
concurrentloop threadid 0 8
statement ok
USE tpch
# thread 1 is doing the refreshes
loop i 1 100
onlyif threadid=0
statement ok
BEGIN
onlyif threadid=0
statement ok
INSERT INTO lineitem FROM read_parquet('/Users/myth/Programs/duckdb-tpch-power-test/gen/sf100/lineitem.tbl.u${i}.parquet')
onlyif threadid=0
statement ok
INSERT INTO orders FROM read_parquet('/Users/myth/Programs/duckdb-tpch-power-test/gen/sf100/orders.tbl.u${i}.parquet')
onlyif threadid=0
statement ok
DELETE FROM orders WHERE o_orderkey IN (SELECT column0 FROM read_parquet('/Users/myth/Programs/duckdb-tpch-power-test/gen/sf100/delete.${i}.parquet'))
onlyif threadid=0
statement ok
DELETE FROM lineitem WHERE l_orderkey IN (SELECT column0 FROM read_parquet('/Users/myth/Programs/duckdb-tpch-power-test/gen/sf100/delete.${i}.parquet'))
onlyif threadid=0
statement ok
COMMIT
endloop
# threads >1 are querying
loop qnr 1 22
skipif threadid=0
statement ok
PRAGMA tpch(${qnr})
endloop
endloop

View File

@@ -0,0 +1,32 @@
# name: test/sql/tpch/tpch_sf0.test
# description: Test TPC-H SF0
# group: [tpch]
require tpch
statement ok
CALL dbgen(sf=0);
loop i 1 23
statement ok
PRAGMA tpch(${i})
endloop
# out of range
statement error
PRAGMA tpch(-1)
----
statement error
PRAGMA tpch(3290819023812038903)
----
statement error
PRAGMA tpch(32908301298)
----
statement error
PRAGMA tpch(1.1)
----

View File

@@ -0,0 +1,32 @@
# name: test/sql/tpch/tpch_sf001.test_slow
# description: Test TPC-H SF0.01
# group: [tpch]
require tpch
statement ok
pragma verify_external
statement ok
PRAGMA verify_serializer
statement ok
CALL dbgen(sf=0.01);
loop i 1 9
query I
PRAGMA tpch(${i})
----
<FILE>:extension/tpch/dbgen/answers/sf0.01/q0${i}.csv
endloop
loop i 10 23
query I
PRAGMA tpch(${i})
----
<FILE>:extension/tpch/dbgen/answers/sf0.01/q${i}.csv
endloop

View File

@@ -0,0 +1,214 @@
# name: test/sql/tpch/tpch_sf001_struct.test_slow
# description: Test TPC-H SF0.01
# group: [tpch]
require tpch
load __TEST_DIR__/tpch_sf001_struct.db
statement ok
CALL dbgen(sf=0.01, suffix='_normal');
statement ok
CREATE TABLE lineitem_struct AS SELECT {
'l_orderkey': l_orderkey,
'l_partkey': l_partkey,
'l_suppkey': l_suppkey,
'l_linenumber': l_linenumber,
'l_quantity': l_quantity,
'l_extendedprice': l_extendedprice,
'l_discount': l_discount,
'l_tax': l_tax,
'l_returnflag': l_returnflag,
'l_linestatus': l_linestatus,
'l_shipdate': l_shipdate,
'l_commitdate': l_commitdate,
'l_receiptdate': l_receiptdate,
'l_shipinstruct': l_shipinstruct,
'l_shipmode': l_shipmode,
'l_comment': l_comment
} c FROM lineitem_normal;
statement ok
CREATE VIEW lineitem AS SELECT
c['l_orderkey'] AS l_orderkey,
c['l_partkey'] AS l_partkey,
c['l_suppkey'] AS l_suppkey,
c['l_linenumber'] AS l_linenumber,
c['l_quantity'] AS l_quantity,
c['l_extendedprice'] AS l_extendedprice,
c['l_discount'] AS l_discount,
c['l_tax'] AS l_tax,
c['l_returnflag'] AS l_returnflag,
c['l_linestatus'] AS l_linestatus,
c['l_shipdate'] AS l_shipdate,
c['l_commitdate'] AS l_commitdate,
c['l_receiptdate'] AS l_receiptdate,
c['l_shipinstruct'] AS l_shipinstruct,
c['l_shipmode'] AS l_shipmode,
c['l_comment'] AS l_comment
FROM lineitem_struct
statement ok
CREATE TABLE orders_struct AS SELECT {
'o_orderkey': o_orderkey,
'o_custkey': o_custkey,
'o_orderstatus': o_orderstatus,
'o_totalprice': o_totalprice,
'o_orderdate': o_orderdate,
'o_orderpriority': o_orderpriority,
'o_clerk': o_clerk,
'o_shippriority': o_shippriority,
'o_comment': o_comment
} c FROM orders_normal;
statement ok
CREATE VIEW orders AS SELECT
c['o_orderkey'] AS o_orderkey,
c['o_custkey'] AS o_custkey,
c['o_orderstatus'] AS o_orderstatus,
c['o_totalprice'] AS o_totalprice,
c['o_orderdate'] AS o_orderdate,
c['o_orderpriority'] AS o_orderpriority,
c['o_clerk'] AS o_clerk,
c['o_shippriority'] AS o_shippriority,
c['o_comment'] AS o_comment
FROM orders_struct
statement ok
CREATE TABLE part_struct AS SELECT {
'p_partkey': p_partkey,
'p_name': p_name,
'p_mfgr': p_mfgr,
'p_brand': p_brand,
'p_type': p_type,
'p_size': p_size,
'p_container': p_container,
'p_retailprice': p_retailprice,
'p_comment': p_comment
} c FROM part_normal;
statement ok
CREATE VIEW part AS SELECT
c['p_partkey'] AS p_partkey,
c['p_name'] AS p_name,
c['p_mfgr'] AS p_mfgr,
c['p_brand'] AS p_brand,
c['p_type'] AS p_type,
c['p_size'] AS p_size,
c['p_container'] AS p_container,
c['p_retailprice'] AS p_retailprice,
c['p_comment'] AS p_comment
FROM part_struct
statement ok
CREATE TABLE partsupp_struct AS SELECT {
'ps_partkey': ps_partkey,
'ps_suppkey': ps_suppkey,
'ps_availqty': ps_availqty,
'ps_supplycost': ps_supplycost,
'ps_comment': ps_comment
} c FROM partsupp_normal;
statement ok
CREATE VIEW partsupp AS SELECT
c['ps_partkey'] AS ps_partkey,
c['ps_suppkey'] AS ps_suppkey,
c['ps_availqty'] AS ps_availqty,
c['ps_supplycost'] AS ps_supplycost,
c['ps_comment'] AS ps_comment
FROM partsupp_struct
statement ok
CREATE TABLE customer_struct AS SELECT {
'c_custkey': c_custkey,
'c_name': c_name,
'c_address': c_address,
'c_nationkey': c_nationkey,
'c_phone': c_phone,
'c_acctbal': c_acctbal,
'c_mktsegment': c_mktsegment,
'c_comment': c_comment
} c FROM customer_normal;
statement ok
CREATE VIEW customer AS SELECT
c['c_custkey'] AS c_custkey,
c['c_name'] AS c_name,
c['c_address'] AS c_address,
c['c_nationkey'] AS c_nationkey,
c['c_phone'] AS c_phone,
c['c_acctbal'] AS c_acctbal,
c['c_mktsegment'] AS c_mktsegment,
c['c_comment'] AS c_comment
FROM customer_struct
statement ok
CREATE TABLE region_struct AS SELECT {
'r_regionkey': r_regionkey,
'r_name': r_name,
'r_comment': r_comment
} c FROM region_normal;
statement ok
CREATE VIEW region AS SELECT
c['r_regionkey'] AS r_regionkey,
c['r_name'] AS r_name,
c['r_comment'] AS r_comment
FROM region_struct
statement ok
CREATE TABLE supplier_struct AS SELECT {
's_suppkey': s_suppkey,
's_name': s_name,
's_address': s_address,
's_nationkey': s_nationkey,
's_phone': s_phone,
's_acctbal': s_acctbal,
's_comment': s_comment
} c FROM supplier_normal;
statement ok
CREATE VIEW supplier AS SELECT
c['s_suppkey'] AS s_suppkey,
c['s_name'] AS s_name,
c['s_address'] AS s_address,
c['s_nationkey'] AS s_nationkey,
c['s_phone'] AS s_phone,
c['s_acctbal'] AS s_acctbal,
c['s_comment'] AS s_comment
FROM supplier_struct
statement ok
CREATE TABLE nation_struct AS SELECT {
'n_nationkey': n_nationkey,
'n_name': n_name,
'n_regionkey': n_regionkey,
'n_comment': n_comment
} c FROM nation_normal;
statement ok
CREATE VIEW nation AS SELECT
c['n_nationkey'] AS n_nationkey,
c['n_name'] AS n_name,
c['n_regionkey'] AS n_regionkey,
c['n_comment'] AS n_comment
FROM nation_struct
loop i 1 9
query I
PRAGMA tpch(${i})
----
<FILE>:extension/tpch/dbgen/answers/sf0.01/q0${i}.csv
endloop
loop i 10 23
query I
PRAGMA tpch(${i})
----
<FILE>:extension/tpch/dbgen/answers/sf0.01/q${i}.csv
endloop

View File

@@ -0,0 +1,26 @@
# name: test/sql/tpch/tpch_sf01.test_slow
# description: Test TPC-H SF0.1
# group: [tpch]
require tpch
statement ok
CALL dbgen(sf=0.1);
loop i 1 9
query I
PRAGMA tpch(${i})
----
<FILE>:extension/tpch/dbgen/answers/sf0.1/q0${i}.csv
endloop
loop i 10 23
query I
PRAGMA tpch(${i})
----
<FILE>:extension/tpch/dbgen/answers/sf0.1/q${i}.csv
endloop

View File

@@ -0,0 +1,29 @@
# name: test/sql/tpch/tpch_sf1.test_slow
# description: Test TPC-H SF1
# group: [tpch]
require tpch
statement ok
pragma verify_external
statement ok
CALL dbgen(sf=1);
loop i 1 9
query I
PRAGMA tpch(${i})
----
<FILE>:extension/tpch/dbgen/answers/sf1/q0${i}.csv
endloop
loop i 10 23
query I
PRAGMA tpch(${i})
----
<FILE>:extension/tpch/dbgen/answers/sf1/q${i}.csv
endloop

View File

@@ -0,0 +1,36 @@
# name: test/sql/tpch/tpch_sf1_no_order.test_slow
# description: Test TPC-H SF1 with unpreserved insertion order
# group: [tpch]
require tpch
statement ok
CALL dbgen(sf=1, suffix='_original');
statement ok
SET preserve_insertion_order=false;
foreach tbl lineitem orders partsupp part customer supplier nation region
statement ok
CREATE TABLE ${tbl} AS SELECT * FROM ${tbl}_original
endloop
loop i 1 9
query I
PRAGMA tpch(${i})
----
<FILE>:extension/tpch/dbgen/answers/sf1/q0${i}.csv
endloop
loop i 10 23
query I
PRAGMA tpch(${i})
----
<FILE>:extension/tpch/dbgen/answers/sf1/q${i}.csv
endloop

View File

@@ -0,0 +1,214 @@
# name: test/sql/tpch/tpch_sf1_struct.test_slow
# description: Test TPC-H SF1
# group: [tpch]
require tpch
load __TEST_DIR__/tpch_sf1_struct.db
statement ok
CALL dbgen(sf=1, suffix='_normal');
statement ok
CREATE TABLE lineitem_struct AS SELECT {
'l_orderkey': l_orderkey,
'l_partkey': l_partkey,
'l_suppkey': l_suppkey,
'l_linenumber': l_linenumber,
'l_quantity': l_quantity,
'l_extendedprice': l_extendedprice,
'l_discount': l_discount,
'l_tax': l_tax,
'l_returnflag': l_returnflag,
'l_linestatus': l_linestatus,
'l_shipdate': l_shipdate,
'l_commitdate': l_commitdate,
'l_receiptdate': l_receiptdate,
'l_shipinstruct': l_shipinstruct,
'l_shipmode': l_shipmode,
'l_comment': l_comment
} c FROM lineitem_normal;
statement ok
CREATE VIEW lineitem AS SELECT
c['l_orderkey'] AS l_orderkey,
c['l_partkey'] AS l_partkey,
c['l_suppkey'] AS l_suppkey,
c['l_linenumber'] AS l_linenumber,
c['l_quantity'] AS l_quantity,
c['l_extendedprice'] AS l_extendedprice,
c['l_discount'] AS l_discount,
c['l_tax'] AS l_tax,
c['l_returnflag'] AS l_returnflag,
c['l_linestatus'] AS l_linestatus,
c['l_shipdate'] AS l_shipdate,
c['l_commitdate'] AS l_commitdate,
c['l_receiptdate'] AS l_receiptdate,
c['l_shipinstruct'] AS l_shipinstruct,
c['l_shipmode'] AS l_shipmode,
c['l_comment'] AS l_comment
FROM lineitem_struct
statement ok
CREATE TABLE orders_struct AS SELECT {
'o_orderkey': o_orderkey,
'o_custkey': o_custkey,
'o_orderstatus': o_orderstatus,
'o_totalprice': o_totalprice,
'o_orderdate': o_orderdate,
'o_orderpriority': o_orderpriority,
'o_clerk': o_clerk,
'o_shippriority': o_shippriority,
'o_comment': o_comment
} c FROM orders_normal;
statement ok
CREATE VIEW orders AS SELECT
c['o_orderkey'] AS o_orderkey,
c['o_custkey'] AS o_custkey,
c['o_orderstatus'] AS o_orderstatus,
c['o_totalprice'] AS o_totalprice,
c['o_orderdate'] AS o_orderdate,
c['o_orderpriority'] AS o_orderpriority,
c['o_clerk'] AS o_clerk,
c['o_shippriority'] AS o_shippriority,
c['o_comment'] AS o_comment
FROM orders_struct
statement ok
CREATE TABLE part_struct AS SELECT {
'p_partkey': p_partkey,
'p_name': p_name,
'p_mfgr': p_mfgr,
'p_brand': p_brand,
'p_type': p_type,
'p_size': p_size,
'p_container': p_container,
'p_retailprice': p_retailprice,
'p_comment': p_comment
} c FROM part_normal;
statement ok
CREATE VIEW part AS SELECT
c['p_partkey'] AS p_partkey,
c['p_name'] AS p_name,
c['p_mfgr'] AS p_mfgr,
c['p_brand'] AS p_brand,
c['p_type'] AS p_type,
c['p_size'] AS p_size,
c['p_container'] AS p_container,
c['p_retailprice'] AS p_retailprice,
c['p_comment'] AS p_comment
FROM part_struct
statement ok
CREATE TABLE partsupp_struct AS SELECT {
'ps_partkey': ps_partkey,
'ps_suppkey': ps_suppkey,
'ps_availqty': ps_availqty,
'ps_supplycost': ps_supplycost,
'ps_comment': ps_comment
} c FROM partsupp_normal;
statement ok
CREATE VIEW partsupp AS SELECT
c['ps_partkey'] AS ps_partkey,
c['ps_suppkey'] AS ps_suppkey,
c['ps_availqty'] AS ps_availqty,
c['ps_supplycost'] AS ps_supplycost,
c['ps_comment'] AS ps_comment
FROM partsupp_struct
statement ok
CREATE TABLE customer_struct AS SELECT {
'c_custkey': c_custkey,
'c_name': c_name,
'c_address': c_address,
'c_nationkey': c_nationkey,
'c_phone': c_phone,
'c_acctbal': c_acctbal,
'c_mktsegment': c_mktsegment,
'c_comment': c_comment
} c FROM customer_normal;
statement ok
CREATE VIEW customer AS SELECT
c['c_custkey'] AS c_custkey,
c['c_name'] AS c_name,
c['c_address'] AS c_address,
c['c_nationkey'] AS c_nationkey,
c['c_phone'] AS c_phone,
c['c_acctbal'] AS c_acctbal,
c['c_mktsegment'] AS c_mktsegment,
c['c_comment'] AS c_comment
FROM customer_struct
statement ok
CREATE TABLE region_struct AS SELECT {
'r_regionkey': r_regionkey,
'r_name': r_name,
'r_comment': r_comment
} c FROM region_normal;
statement ok
CREATE VIEW region AS SELECT
c['r_regionkey'] AS r_regionkey,
c['r_name'] AS r_name,
c['r_comment'] AS r_comment
FROM region_struct;
statement ok
CREATE TABLE supplier_struct AS SELECT {
's_suppkey': s_suppkey,
's_name': s_name,
's_address': s_address,
's_nationkey': s_nationkey,
's_phone': s_phone,
's_acctbal': s_acctbal,
's_comment': s_comment
} c FROM supplier_normal;
statement ok
CREATE VIEW supplier AS SELECT
c['s_suppkey'] AS s_suppkey,
c['s_name'] AS s_name,
c['s_address'] AS s_address,
c['s_nationkey'] AS s_nationkey,
c['s_phone'] AS s_phone,
c['s_acctbal'] AS s_acctbal,
c['s_comment'] AS s_comment
FROM supplier_struct
statement ok
CREATE TABLE nation_struct AS SELECT {
'n_nationkey': n_nationkey,
'n_name': n_name,
'n_regionkey': n_regionkey,
'n_comment': n_comment
} c FROM nation_normal;
statement ok
CREATE VIEW nation AS SELECT
c['n_nationkey'] AS n_nationkey,
c['n_name'] AS n_name,
c['n_regionkey'] AS n_regionkey,
c['n_comment'] AS n_comment
FROM nation_struct
loop i 1 9
query I
PRAGMA tpch(${i})
----
<FILE>:extension/tpch/dbgen/answers/sf1/q0${i}.csv
endloop
loop i 10 23
query I
PRAGMA tpch(${i})
----
<FILE>:extension/tpch/dbgen/answers/sf1/q${i}.csv
endloop

View File

@@ -0,0 +1,41 @@
# name: test/sql/tpch/tpch_sf1_struct_parquet.test_slow
# description: Test TPC-H SF1
# group: [tpch]
require parquet
require tpch
load __TEST_DIR__/tpch_sf1_struct.db
statement ok
CALL dbgen(sf=1, suffix='_normal');
foreach tbl customer lineitem nation orders part partsupp region supplier
statement ok
COPY (SELECT ${tbl}_normal val FROM ${tbl}_normal) TO '__TEST_DIR__/${tbl}_struct_sf1.parquet'
statement ok
CREATE VIEW ${tbl} AS SELECT UNNEST(val) FROM read_parquet('__TEST_DIR__/${tbl}_struct_sf1.parquet')
endloop
loop i 1 9
query I
PRAGMA tpch(${i})
----
<FILE>:extension/tpch/dbgen/answers/sf1/q0${i}.csv
endloop
loop i 10 23
query I
PRAGMA tpch(${i})
----
<FILE>:extension/tpch/dbgen/answers/sf1/q${i}.csv
endloop

View File

@@ -0,0 +1,51 @@
# name: test/sql/tpch/tpch_topn.test_slow
# description: Test top-n queries on TPC-H
# group: [tpch]
require tpch
statement ok
PRAGMA enable_verification
statement ok
CALL dbgen(sf=1);
query IIIIIIII
SELECT o_orderkey, o_custkey, o_orderstatus, o_totalprice, o_orderdate, o_orderpriority, o_clerk, o_shippriority FROM orders ORDER BY o_orderkey LIMIT 5;
----
1 36901 O 173665.47 1996-01-02 5-LOW Clerk#000000951 0
2 78002 O 46929.18 1996-12-01 1-URGENT Clerk#000000880 0
3 123314 F 193846.25 1993-10-14 5-LOW Clerk#000000955 0
4 136777 O 32151.78 1995-10-11 5-LOW Clerk#000000124 0
5 44485 F 144659.20 1994-07-30 5-LOW Clerk#000000925 0
query IIIIIIII
SELECT o_orderkey, o_custkey, o_orderstatus, o_totalprice, o_orderdate, o_orderpriority, o_clerk, o_shippriority FROM orders ORDER BY o_orderkey DESC LIMIT 5;
----
6000000 110063 O 37625.29 1996-08-31 2-HIGH Clerk#000000411 0
5999975 113398 F 63216.65 1993-07-25 1-URGENT Clerk#000000813 0
5999974 55448 F 92750.90 1993-07-28 3-MEDIUM Clerk#000000776 0
5999973 32071 O 68906.56 1997-07-13 4-NOT SPECIFIED Clerk#000000130 0
5999972 143594 O 114856.68 1996-05-02 3-MEDIUM Clerk#000000536 0
query IIIIIIIIIIIIIII
SELECT l_orderkey, l_partkey, l_suppkey, l_linenumber, l_quantity, l_extendedprice, l_discount, l_tax, l_returnflag, l_linestatus, l_shipdate, l_commitdate, l_receiptdate, l_shipinstruct, l_shipmode FROM lineitem ORDER BY l_shipdate, l_orderkey LIMIT 5;
----
721220 177803 5355 2 19 35735.20 0.08 0.03 R F 1992-01-02 1992-02-04 1992-01-09 TAKE BACK RETURN SHIP
842980 188156 5711 4 5 6220.75 0.01 0.03 A F 1992-01-02 1992-03-20 1992-01-20 COLLECT COD REG AIR
904677 56678 1689 1 43 70290.81 0.08 0.01 R F 1992-01-02 1992-03-22 1992-01-14 COLLECT COD AIR
990147 154290 4291 1 6 8065.74 0.10 0.01 R F 1992-01-02 1992-03-01 1992-01-15 NONE REG AIR
1054181 16217 6218 1 45 50994.45 0.03 0.08 R F 1992-01-02 1992-02-05 1992-01-15 NONE MAIL
query IIIIIIIIIIIIIII
SELECT l_orderkey,l_partkey,l_suppkey,l_linenumber,l_quantity,l_extendedprice,l_discount,l_tax,l_returnflag,l_linestatus,l_shipdate,l_commitdate,l_receiptdate,l_shipinstruct,l_shipmode FROM lineitem ORDER BY l_orderkey DESC, l_shipdate DESC LIMIT 5;
----
6000000 32255 2256 1 5 5936.25 0.04 0.03 N O 1996-11-02 1996-11-19 1996-12-01 TAKE BACK RETURN MAIL
6000000 96127 6128 2 28 31447.36 0.01 0.02 N O 1996-09-22 1996-10-01 1996-10-21 NONE AIR
5999975 37131 2138 3 18 19226.34 0.04 0.01 A F 1993-11-17 1993-08-28 1993-12-08 DELIVER IN PERSON FOB
5999975 6452 1453 2 7 9509.15 0.04 0.00 A F 1993-11-02 1993-09-23 1993-11-19 DELIVER IN PERSON SHIP
5999975 7272 2273 1 32 37736.64 0.07 0.01 R F 1993-10-07 1993-09-30 1993-10-21 COLLECT COD REG AIR
# test issue 18028
statement ok
SELECT * FROM (SELECT * FROM lineitem LIMIT 500) ORDER BY l_orderkey DESC LIMIT 10;