-
Notifications
You must be signed in to change notification settings - Fork 590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(sqlsmith, deterministic-test): deterministic fuzz stability #7967
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
b6d1ab3
consolidate error reason for easier error reporting
kwannoel afb5289
add query generator and runner for pre-generated queries
kwannoel 0eb23a0
add cli interfaces
kwannoel e24aa2a
write generated query to file
kwannoel 6f50ba5
add outdir
kwannoel 5906a37
format output sql
kwannoel 21bfa4f
fix run pre-gen logic
kwannoel 8d2053f
fix
kwannoel 43efc86
update ci to use pre-generated queries for PRs and main
kwannoel a7fd394
add tracing
kwannoel c6c4d83
add script to generate N deterministic fuzzing queries
kwannoel 7f471e1
avoid recompile
kwannoel 5e17adb
do parallel gen via deterministic simulation
kwannoel 95223ae
gen
kwannoel a67fb87
fmt
kwannoel 19349b9
add explanation
kwannoel 4c67437
fix
kwannoel e042515
Use `query` instead of `execute` for queries expected to return results
kwannoel 905ad3e
Merge remote-tracking branch 'origin' into deterministic-fuzz-stability
kwannoel e2fc0d4
fix
kwannoel b85274e
update freeze.zip
kwannoel d744850
fix
kwannoel e6bcfec
use text
kwannoel 9a292c3
ignore sqlsmith artifacts in typochecker
kwannoel 646de18
Merge branch 'main' into deterministic-fuzz-stability
mergify[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euxo pipefail | ||
|
||
export TEST_NUM=32 | ||
export RW_HOME="../../../.." | ||
export LOGDIR=".risingwave/log" | ||
export TESTS_FOLDER="src/tests/sqlsmith/tests" | ||
export OUTDIR="$TESTS_FOLDER/freeze" | ||
export TESTDATA="src/tests/sqlsmith/tests/testdata" | ||
export MADSIM_BIN="target/sim/ci-sim/risingwave_simulation" | ||
|
||
build_madsim() { | ||
cargo make sslt-build-all --profile ci-sim | ||
} | ||
|
||
generate_deterministic() { | ||
seq "$TEST_NUM" | \ | ||
parallel "mkdir -p $OUTDIR/{}; \ | ||
MADSIM_TEST_SEED={} $MADSIM_BIN \ | ||
--sqlsmith 100 \ | ||
--generate-sqlsmith-queries $OUTDIR/{} \ | ||
$TESTDATA \ | ||
2> $LOGDIR/fuzzing-{}.log && rm $LOGDIR/fuzzing-{}.log" | ||
} | ||
|
||
generate_sqlsmith() { | ||
mkdir -p "$OUTDIR/$1" | ||
./risedev d | ||
./target/debug/sqlsmith test \ | ||
--testdata ./src/tests/sqlsmith/tests/testdata \ | ||
--generate "$OUTDIR/$1" | ||
} | ||
|
||
main() { | ||
cd $RW_HOME | ||
build_madsim | ||
generate_deterministic | ||
cd - | ||
} | ||
|
||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
CREATE TABLE supplier (s_suppkey INT, s_name CHARACTER VARYING, s_address CHARACTER VARYING, s_nationkey INT, s_phone CHARACTER VARYING, s_acctbal NUMERIC, s_comment CHARACTER VARYING, PRIMARY KEY (s_suppkey)); | ||
CREATE TABLE part (p_partkey INT, p_name CHARACTER VARYING, p_mfgr CHARACTER VARYING, p_brand CHARACTER VARYING, p_type CHARACTER VARYING, p_size INT, p_container CHARACTER VARYING, p_retailprice NUMERIC, p_comment CHARACTER VARYING, PRIMARY KEY (p_partkey)); | ||
CREATE TABLE partsupp (ps_partkey INT, ps_suppkey INT, ps_availqty INT, ps_supplycost NUMERIC, ps_comment CHARACTER VARYING, PRIMARY KEY (ps_partkey, ps_suppkey)); | ||
CREATE TABLE customer (c_custkey INT, c_name CHARACTER VARYING, c_address CHARACTER VARYING, c_nationkey INT, c_phone CHARACTER VARYING, c_acctbal NUMERIC, c_mktsegment CHARACTER VARYING, c_comment CHARACTER VARYING, PRIMARY KEY (c_custkey)); | ||
CREATE TABLE orders (o_orderkey BIGINT, o_custkey INT, o_orderstatus CHARACTER VARYING, o_totalprice NUMERIC, o_orderdate DATE, o_orderpriority CHARACTER VARYING, o_clerk CHARACTER VARYING, o_shippriority INT, o_comment CHARACTER VARYING, PRIMARY KEY (o_orderkey)); | ||
CREATE TABLE lineitem (l_orderkey BIGINT, l_partkey INT, l_suppkey INT, l_linenumber INT, l_quantity NUMERIC, l_extendedprice NUMERIC, l_discount NUMERIC, l_tax NUMERIC, l_returnflag CHARACTER VARYING, l_linestatus CHARACTER VARYING, l_shipdate DATE, l_commitdate DATE, l_receiptdate DATE, l_shipinstruct CHARACTER VARYING, l_shipmode CHARACTER VARYING, l_comment CHARACTER VARYING, PRIMARY KEY (l_orderkey, l_linenumber)); | ||
CREATE TABLE nation (n_nationkey INT, n_name CHARACTER VARYING, n_regionkey INT, n_comment CHARACTER VARYING, PRIMARY KEY (n_nationkey)); | ||
CREATE TABLE region (r_regionkey INT, r_name CHARACTER VARYING, r_comment CHARACTER VARYING, PRIMARY KEY (r_regionkey)); | ||
CREATE TABLE person (id BIGINT, name CHARACTER VARYING, email_address CHARACTER VARYING, credit_card CHARACTER VARYING, city CHARACTER VARYING, state CHARACTER VARYING, date_time TIMESTAMP, extra CHARACTER VARYING, PRIMARY KEY (id)); | ||
CREATE TABLE auction (id BIGINT, item_name CHARACTER VARYING, description CHARACTER VARYING, initial_bid BIGINT, reserve BIGINT, date_time TIMESTAMP, expires TIMESTAMP, seller BIGINT, category BIGINT, extra CHARACTER VARYING, PRIMARY KEY (id)); | ||
CREATE TABLE bid (auction BIGINT, bidder BIGINT, price BIGINT, channel CHARACTER VARYING, url CHARACTER VARYING, date_time TIMESTAMP, extra CHARACTER VARYING); | ||
CREATE TABLE alltypes1 (c1 BOOLEAN, c2 SMALLINT, c3 INT, c4 BIGINT, c5 REAL, c6 DOUBLE, c7 NUMERIC, c8 DATE, c9 CHARACTER VARYING, c10 TIME, c11 TIMESTAMP, c13 INTERVAL, c14 STRUCT<a INT>, c15 INT[], c16 CHARACTER VARYING[]); | ||
CREATE TABLE alltypes2 (c1 BOOLEAN, c2 SMALLINT, c3 INT, c4 BIGINT, c5 REAL, c6 DOUBLE, c7 NUMERIC, c8 DATE, c9 CHARACTER VARYING, c10 TIME, c11 TIMESTAMP, c13 INTERVAL, c14 STRUCT<a INT>, c15 INT[], c16 CHARACTER VARYING[]); | ||
CREATE MATERIALIZED VIEW m1 AS SELECT (TRIM(LEADING ('PCMqvE5FrE') FROM t_0.c9)) AS col_0, (ARRAY[(INT '981'), (INT '42'), (INT '738'), (INT '763')]) AS col_1, t_0.c2 AS col_2, (INTERVAL '3600') AS col_3 FROM alltypes1 AS t_0 JOIN region AS t_1 ON t_0.c9 = t_1.r_comment AND t_0.c1 GROUP BY t_0.c2, t_0.c8, t_0.c15, t_0.c9, t_0.c16, t_1.r_name, t_0.c5, t_0.c7, t_0.c6 HAVING true; | ||
CREATE MATERIALIZED VIEW m2 AS SELECT t_0.c1 AS col_0, t_0.c1 AS col_1, t_0.c1 AS col_2, true AS col_3 FROM alltypes2 AS t_0 GROUP BY t_0.c1 HAVING ((832) > ((100) + (SMALLINT '746'))); | ||
CREATE MATERIALIZED VIEW m3 AS SELECT t_1.p_size AS col_0 FROM m1 AS t_0 LEFT JOIN part AS t_1 ON t_0.col_0 = t_1.p_type AND true GROUP BY t_1.p_type, t_0.col_3, t_1.p_size, t_1.p_brand, t_1.p_comment; | ||
CREATE MATERIALIZED VIEW m4 AS WITH with_0 AS (SELECT t_1.l_shipmode AS col_0, 'kZrMWYVcBV' AS col_1 FROM lineitem AS t_1 LEFT JOIN customer AS t_2 ON t_1.l_shipmode = t_2.c_address GROUP BY t_1.l_quantity, t_1.l_returnflag, t_2.c_comment, t_1.l_partkey, t_1.l_shipmode HAVING (avg((INTERVAL '-900581')) = TIME '02:05:33')) SELECT (802) AS col_0 FROM with_0; | ||
CREATE MATERIALIZED VIEW m5 AS SELECT (upper((TRIM(t_0.r_comment)))) AS col_0, (coalesce(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, t_0.r_regionkey)) AS col_1, t_0.r_comment AS col_2 FROM region AS t_0 RIGHT JOIN region AS t_1 ON t_0.r_comment = t_1.r_comment AND true WHERE true GROUP BY t_0.r_regionkey, t_0.r_comment; | ||
CREATE MATERIALIZED VIEW m6 AS SELECT '2qpwrIfYuD' AS col_0 FROM (SELECT (TIMESTAMP '2022-01-02 01:05:34') AS col_0, (TRIM(('nUPadiPg61'))) AS col_1, (t_0.seller & t_0.seller) AS col_2, t_0.date_time AS col_3 FROM auction AS t_0 GROUP BY t_0.id, t_0.seller, t_0.date_time, t_0.item_name) AS sq_1 WHERE true GROUP BY sq_1.col_3 HAVING CAST((INT '681') AS BOOLEAN); | ||
CREATE MATERIALIZED VIEW m7 AS WITH with_0 AS (SELECT (hop_1.id % (SMALLINT '512')) AS col_0 FROM hop(person, person.date_time, INTERVAL '86400', INTERVAL '5702400') AS hop_1 WHERE false GROUP BY hop_1.id) SELECT (584) AS col_0, ((REAL '613')) AS col_1 FROM with_0 WHERE true; | ||
CREATE MATERIALIZED VIEW m8 AS SELECT (OVERLAY(sq_2.col_2 PLACING sq_2.col_2 FROM sq_2.col_1)) AS col_0, sq_2.col_2 AS col_1, max((REAL '0')) AS col_2 FROM (SELECT (INT '417') AS col_0, t_1.c3 AS col_1, t_1.c9 AS col_2 FROM customer AS t_0 JOIN alltypes2 AS t_1 ON t_0.c_phone = t_1.c9 WHERE t_1.c1 GROUP BY t_0.c_comment, t_1.c11, t_1.c3, t_0.c_custkey, t_1.c2, t_1.c9, t_0.c_mktsegment, t_1.c8, t_1.c16, t_1.c5, t_0.c_address) AS sq_2 WHERE false GROUP BY sq_2.col_2, sq_2.col_1; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we can support ignoring cases, this seems not necessary any more. In my mind, we can generate cases regardless of success of failure, and then mark to ignore thse unsupported ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, plan to work on this in a separate PR.