diff --git a/parquet-generator/create-pg-db b/parquet-generator/create-pg-db index 9a08e0a..48f476a 100755 --- a/parquet-generator/create-pg-db +++ b/parquet-generator/create-pg-db @@ -10,7 +10,7 @@ createdb parquet here=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")") psql parquet << EOF -CREATE TABLE no_nulls( +CREATE TABLE no_nulls1( rowid INT2, bool_0 INT2, int8_1 INT2, @@ -25,9 +25,11 @@ CREATE TABLE no_nulls( binary_10 TEXT ); -CREATE TABLE nulls (LIKE no_nulls); +CREATE TABLE no_nulls2 (LIKE no_nulls1); +CREATE TABLE nulls (LIKE no_nulls1); -COPY no_nulls FROM '$here/no-nulls.csv'; +COPY no_nulls1 FROM '$here/no-nulls.csv'; +COPY no_nulls2 FROM '$here/no-nulls.csv'; COPY nulls FROM '$here/nulls.csv'; CREATE OR REPLACE FUNCTION quote(TEXT) RETURNS TEXT AS \$\$ @@ -47,9 +49,4 @@ CREATE OR REPLACE FUNCTION printf(TEXT, DOUBLE PRECISION) RETURNS TEXT AS \$\$ RETURN CAST(\$2 AS DECIMAL(10, 4))::TEXT; END; \$\$ LANGUAGE 'plpgsql' IMMUTABLE; - - - ---COPY (SELECT rowid, bool_0, int8_1, int16_2, int32_3, int64_4, datetime(ts_5 / 1000, 'unixepoch'), double_6, string_7, string_8, quote(binary_9), quote(binary_10) FROM nulls LIMIT 3) TO STDOUT WITH (DELIMITER '|', NULL ''); -COPY (SELECT rowid, bool_0, int8_1, int16_2, int32_3, int64_4, datetime(ts_5 / 1000, 'unixepoch'), printf('%.4f', double_6) AS double_6, string_7, string_8, quote(binary_9), quote(binary_10) FROM no_nulls) TO STDOUT WITH (DELIMITER '|', NULL ''); EOF diff --git a/tests/queries/001-table-scan-1-rowgroup.sql b/tests/queries/001-table-scan-1-rowgroup.sql index e4ecc08..84c8d1a 100644 --- a/tests/queries/001-table-scan-1-rowgroup.sql +++ b/tests/queries/001-table-scan-1-rowgroup.sql @@ -1,5 +1,4 @@ -100-rows-1.parquet -SELECT rowid, bool_0, int8_1, int16_2, int32_3, int64_4, datetime(ts_5 / 1000, 'unixepoch'), printf("%.4f", double_6) AS double_6, string_7, string_8, quote(binary_9), quote(binary_10) FROM test; +SELECT rowid, bool_0, int8_1, int16_2, int32_3, int64_4, datetime(ts_5 / 1000, 'unixepoch'), printf("%.4f", double_6) AS double_6, string_7, string_8, quote(binary_9), quote(binary_10) FROM no_nulls1; 0|1|50|5000|50000000|50000000000|1985-07-20 00:00:00|100.0000|0|000|X'00'|X'00' 1|0|49|4900|49000000|49000000000|1985-07-21 00:00:00|50.0000|1|001|X'0101'|X'01' 2|1|48|4800|48000000|48000000000|1985-07-22 00:00:00|33.3333|2|002|X'020202'|X'02' diff --git a/tests/queries/002-table-scan-10-rowgroups.sql b/tests/queries/002-table-scan-10-rowgroups.sql index 0793844..224b235 100644 --- a/tests/queries/002-table-scan-10-rowgroups.sql +++ b/tests/queries/002-table-scan-10-rowgroups.sql @@ -1,5 +1,4 @@ -100-rows-10.parquet -SELECT rowid, bool_0, int8_1, int16_2, int32_3, int64_4, datetime(ts_5 / 1000, 'unixepoch'), printf("%.4f", double_6) AS double_6, string_7, string_8, quote(binary_9), quote(binary_10) FROM test; +SELECT rowid, bool_0, int8_1, int16_2, int32_3, int64_4, datetime(ts_5 / 1000, 'unixepoch'), printf("%.4f", double_6) AS double_6, string_7, string_8, quote(binary_9), quote(binary_10) FROM no_nulls2; 0|1|50|5000|50000000|50000000000|1985-07-20 00:00:00|100.0000|0|000|X'00'|X'00' 1|0|49|4900|49000000|49000000000|1985-07-21 00:00:00|50.0000|1|001|X'0101'|X'01' 2|1|48|4800|48000000|48000000000|1985-07-22 00:00:00|33.3333|2|002|X'020202'|X'02' diff --git a/tests/queries/003-cross-join-count-1-rowgroup.sql b/tests/queries/003-cross-join-count-1-rowgroup.sql index 4d0f646..7d00e1a 100644 --- a/tests/queries/003-cross-join-count-1-rowgroup.sql +++ b/tests/queries/003-cross-join-count-1-rowgroup.sql @@ -1,3 +1,2 @@ -100-rows-1.parquet -select count(*) from (select * from test t1, test t2); +select count(*) from (select * from no_nulls1 t1, no_nulls1 t2); 10000 diff --git a/tests/queries/004-cross-join-10-rowgroups.sql b/tests/queries/004-cross-join-10-rowgroups.sql index 536f1bf..9ed0765 100644 --- a/tests/queries/004-cross-join-10-rowgroups.sql +++ b/tests/queries/004-cross-join-10-rowgroups.sql @@ -1,3 +1,2 @@ -100-rows-10.parquet -select count(*) from (select * from test t1, test t2); +select count(*) from (select * from no_nulls2 t1, no_nulls2 t2); 10000 diff --git a/tests/queries/005-rowid-1-rowgroup.sql b/tests/queries/005-rowid-1-rowgroup.sql index 8ba7801..df4f2b8 100644 --- a/tests/queries/005-rowid-1-rowgroup.sql +++ b/tests/queries/005-rowid-1-rowgroup.sql @@ -1,3 +1,2 @@ -100-rows-1.parquet -select int8_1 from test where rowid = 50; +select int8_1 from no_nulls1 where rowid = 50; 0 diff --git a/tests/queries/006-rowid-10-rowgroups.sql b/tests/queries/006-rowid-10-rowgroups.sql index 3ef3362..ef6860d 100644 --- a/tests/queries/006-rowid-10-rowgroups.sql +++ b/tests/queries/006-rowid-10-rowgroups.sql @@ -1,3 +1,2 @@ -100-rows-10.parquet -select int8_1 from test where rowid = 50; +select int8_1 from no_nulls2 where rowid = 50; 0 diff --git a/tests/queries/007-rowid-55-10-rowgroups.sql b/tests/queries/007-rowid-55-10-rowgroups.sql index d9a63ee..8c0f7a1 100644 --- a/tests/queries/007-rowid-55-10-rowgroups.sql +++ b/tests/queries/007-rowid-55-10-rowgroups.sql @@ -1,3 +1,2 @@ -100-rows-10.parquet -select int8_1 from test where rowid = 55; +select int8_1 from no_nulls2 where rowid = 55; -5 diff --git a/tests/queries/008-nulls.sql b/tests/queries/008-nulls.sql index a113c7d..0dec51c 100644 --- a/tests/queries/008-nulls.sql +++ b/tests/queries/008-nulls.sql @@ -1,3 +1,2 @@ -100-rows-nulls.parquet -SELECT SUM(CASE WHEN bool_0 IS NULL THEN 1 ELSE 0 END), SUM(CASE WHEN int8_1 IS NULL THEN 1 ELSE 0 END), SUM(CASE WHEN int16_2 IS NULL THEN 1 ELSE 0 END), SUM(CASE WHEN int32_3 IS NULL THEN 1 ELSE 0 END), SUM(CASE WHEN int64_4 IS NULL THEN 1 ELSE 0 END), SUM(CASE WHEN ts_5 IS NULL THEN 1 ELSE 0 END), SUM(CASE WHEN double_6 IS NULL THEN 1 ELSE 0 END), SUM(CASE WHEN string_7 IS NULL THEN 1 ELSE 0 END), SUM(CASE WHEN string_8 IS NULL THEN 1 ELSE 0 END), SUM(CASE WHEN binary_9 IS NULL THEN 1 ELSE 0 END), SUM(CASE WHEN binary_10 IS NULL THEN 1 ELSE 0 END) from test; +SELECT SUM(CASE WHEN bool_0 IS NULL THEN 1 ELSE 0 END), SUM(CASE WHEN int8_1 IS NULL THEN 1 ELSE 0 END), SUM(CASE WHEN int16_2 IS NULL THEN 1 ELSE 0 END), SUM(CASE WHEN int32_3 IS NULL THEN 1 ELSE 0 END), SUM(CASE WHEN int64_4 IS NULL THEN 1 ELSE 0 END), SUM(CASE WHEN ts_5 IS NULL THEN 1 ELSE 0 END), SUM(CASE WHEN double_6 IS NULL THEN 1 ELSE 0 END), SUM(CASE WHEN string_7 IS NULL THEN 1 ELSE 0 END), SUM(CASE WHEN string_8 IS NULL THEN 1 ELSE 0 END), SUM(CASE WHEN binary_9 IS NULL THEN 1 ELSE 0 END), SUM(CASE WHEN binary_10 IS NULL THEN 1 ELSE 0 END) from nulls; 50|50|50|50|50|50|50|50|50|50|50 diff --git a/tests/test-queries b/tests/test-queries index 1856f9c..d025971 100755 --- a/tests/test-queries +++ b/tests/test-queries @@ -6,14 +6,15 @@ set -euo pipefail run_query() { file=${1:?must provide testcase file} - parquet_file=${2:?must provide parquet file to load} - query=${3:?must provide query to run} + query=${2:?must provide query to run} basename=$(basename "$file") cat < testcase-stdout.txt 2> testcase-stderr.txt; then + query=$(head -n1 "$file" | tail -n1) + results=$(tail -n+2 "$file") + if ! "$root"/sqlite/sqlite3 -init <(run_query "$file" "$query") < /dev/null > testcase-stdout.txt 2> testcase-stderr.txt; then echo "...FAILED; check testcase-{out,err}.txt" >&2 exit 1 fi