-
Notifications
You must be signed in to change notification settings - Fork 5
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
Multi statement, Attach, Detach, Use statements support #1
Conversation
hmeriann
commented
Jun 5, 2024
- Added multi-statement generation to the fuzzyduck.cpp;
- StatementGenerator::RandomValue() and StatementGenerator::RandomPercentage() became public to be used in fuzzyduck.cpp
…or::RandomValue() and StatementGenerator::RandomPercentage() became public
|
Edit: Nevermind, this is just for multi statements, and the PR to add attach & use will come later |
…ET) statements generation
@Mytherin could you please have a look at this PR? |
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.
Just the one comment. Otherwise Looks good to me from here
src/statement_generator.cpp
Outdated
#include "duckdb/parser/statement/update_statement.hpp" | ||
#include "duckdb/parser/tableref/list.hpp" | ||
|
||
#define TESTING_DIRECTORY_NAME "duckdb_unittest_tempdir" |
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.
Now that duckdb_sqlsmith is an extension and has duckdb as a submodule is it possible to use the TESTING_DIRECTORY_NAME
declaration from test/helpers/test_helpers.cpp
?
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.
you might have to include duckdb/test/include/test_helpers.hpp
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.
Defined new TESTING_DIRECTORY_NAME, also put it in the .gitignore
Oh shoot, I'm just realizing now that maybe the |
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.
So I think we should stick with "duckdb_unittest_tempdir". This directory is already in the .gitignore
. Also, if someone builds sqlsmith in the duckdb directory or in the sqlsmith directory, the databases attached by the attach and use will automatically be in the .gitignore
src/statement_generator.cpp
Outdated
auto info = make_uniq<AttachInfo>(); | ||
auto fs = FileSystem::CreateLocal(); | ||
// check if the directory exists | ||
if (!fs->DirectoryExists(string("../") + TESTING_DIRECTORY_NAME)) { |
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.
remove the "../" these cause the testing directory to end up in a weird place
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.
Removed - now it puts files generated during testing to the proper duckdb_unittest_tempdir
… the paths to duckdb_unittest_tempdir
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.
Looks good! Perhaps in the future we want to, instead of using USE
, directly refer to attached databases in queries? That way we can also fuzz queries that access multiple databases, e.g.:
ATTACH ':memory:' AS db1;
CREATE TABLE db1.t1(i INT);
ATTACH ':memory:' AS db2;
CREATE TABLE db2.t2(i INT);
SELECT * FROM db1.t1, db2.t2;
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.
lgtm 👍 . Also agree with Mark that we can just directly refer to persistent databases in the future instead of using USE
Have created an issue for fuzzing across databases #2. |
Thanks! |