Skip to content
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

Replace hardcoded percentages with values from a file #27

Open
wants to merge 40 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
922b9af
add RandomConfigs class with default values and applied to the Genera…
hmeriann Aug 22, 2024
88949bc
add a class for random numbers configuraion
hmeriann Sep 3, 2024
1632858
change statement generator to work with the RandomsConfig
hmeriann Sep 3, 2024
aaac78c
rename randoms config
hmeriann Sep 4, 2024
c1506c5
mention random_nums_config files in the CMakes
hmeriann Sep 4, 2024
f602008
a json string gets parsed
hmeriann Sep 11, 2024
e08843b
parseJSONMap and initialise RandomNumsConfig with the custom values f…
hmeriann Sep 12, 2024
f629ec1
Merge remote-tracking branch 'upstream/main' into random-values-from-…
hmeriann Sep 12, 2024
fa89b25
fix paths to the reusable workflows, since they were moved to the .wo…
hmeriann Sep 12, 2024
6751d00
Merge branch 'main' into random-values-from-file
hmeriann Sep 13, 2024
11c5910
add randoms_config_handle to fuzzyduck
hmeriann Sep 13, 2024
566aff3
add config file
hmeriann Sep 13, 2024
87d6a03
FileSystem::ReadFile uses reads the file with all the new line symbol…
hmeriann Sep 13, 2024
de5cada
pass config file path as randoms_config_filepath parameter
hmeriann Sep 13, 2024
ce877c4
turn the RandomNumsConfig into an unorderdered_map<percentages_enum, …
hmeriann Sep 24, 2024
38757a5
rename to RandomPercentagesEnum
hmeriann Sep 24, 2024
26ba5ec
fixed missing values
hmeriann Sep 24, 2024
7275d9a
GetDefaultConfig() instead of throwing an exception when the file wit…
hmeriann Sep 24, 2024
ad51bdd
do not declare a variable for config again
hmeriann Sep 25, 2024
1430522
remove file handling, because it's being handled by yyjson_read_file
hmeriann Sep 25, 2024
3d395fd
add randoms_config_filepath to scripts/run_fuzzer.py
hmeriann Sep 25, 2024
4930d43
naive way to parse nested config.json to a map
hmeriann Sep 26, 2024
fb32a9d
config_nested.json file
hmeriann Sep 26, 2024
73b1cf1
parseJson recursively
hmeriann Sep 26, 2024
58d4908
a test file
hmeriann Sep 26, 2024
2b9ae4d
clean up
hmeriann Sep 26, 2024
f8aea67
set values of missing in the config file statement types to 0
hmeriann Sep 26, 2024
5e5e7ad
add missing quote
hmeriann Sep 27, 2024
0ddd49c
update the config file with almost all randoms
hmeriann Sep 27, 2024
7ada4b3
update src/include/random_nums_config.hpp to align with the config
hmeriann Sep 27, 2024
4cfe8c4
update StringToRandomPercentagesEnum in the src/random_nums_config.cpp
hmeriann Sep 27, 2024
ea50779
config_nested.json with all the default values
hmeriann Sep 30, 2024
c3c7725
src/include/random_nums_config.hpp corrected names
hmeriann Sep 30, 2024
ebe03d5
pass config to the statement generator
hmeriann Sep 30, 2024
5b8f652
rename some values
hmeriann Sep 30, 2024
628f2d8
remove duplicating line
hmeriann Sep 30, 2024
1a1ff8a
make RandomNumsConfig class
hmeriann Oct 3, 2024
ef48353
limit count of generated set operations
hmeriann Oct 10, 2024
3cd1bfb
set percentage to setop
hmeriann Oct 11, 2024
db0645b
add more values from the config file
hmeriann Oct 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
mention random_nums_config files in the CMakes
hmeriann committed Sep 4, 2024
commit c1506c5c2cf2edeb0e3bec07e95f1e67a7a9c9ee
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@
set(EXTENSION_SOURCES src/sqlsmith_extension.cpp
src/statement_generator.cpp
src/statement_simplifier.cpp
src/random_nums_config.cpp
src/fuzzyduck.cpp ${EXTENSION_OBJECT_FILES})

build_static_extension(${TARGET_NAME} ${EXTENSION_SOURCES})
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ include_directories(third_party/sqlsmith/include)
add_subdirectory(third_party)

set(SQLSMITH_SOURCES
sqlsmith_extension.cpp statement_generator.cpp statement_simplifier.cpp
sqlsmith_extension.cpp statement_generator.cpp statement_simplifier.cpp random_nums_config.cpp
fuzzyduck.cpp ${SQLSMITH_OBJECT_FILES})

build_static_extension(sqlsmith ${SQLSMITH_SOURCES})
29 changes: 11 additions & 18 deletions src/include/random_nums_config.hpp
Original file line number Diff line number Diff line change
@@ -13,30 +13,23 @@
namespace duckdb {

class RandomNumsConfig {
private:

idx_t select_percentage = 60;
idx_t attach_percentage = 40;
idx_t attach_use_percentage = 50;
idx_t detach_percentage = 60;
idx_t set_percentage = 30;
idx_t delete_percentage = 40;

public:
RandomNumsConfig() {

};
idx_t select_percentage;
idx_t attach_percentage;
idx_t attach_use_percentage;
idx_t detach_percentage;
idx_t set_percentage;
idx_t delete_percentage;

RandomNumsConfig();
~RandomNumsConfig();

// is it better to return an object initialised with fetched/default params?
// read file and update default values
void getConfigFromFile(duckdb_string_t file_path) {

}

void GetConfigFromFile(duckdb_string_t file_path);
// set default values
void GetDefaultConfig() {

}
void GetDefaultConfig();

};

2 changes: 0 additions & 2 deletions src/include/statement_generator.hpp
Original file line number Diff line number Diff line change
@@ -11,7 +11,6 @@
#include "duckdb.hpp"
#include "duckdb/parser/parsed_data/detach_info.hpp"
#include "duckdb/parser/query_node.hpp"
#include "src/include/random_nums_config.hpp"

#define TESTING_DIRECTORY_NAME "duckdb_unittest_tempdir"

@@ -41,7 +40,6 @@ class StatementGenerator {
friend class ExpressionDepthChecker;
friend class AggregateChecker;
friend class WindowChecker;
RandomNumsConfig random_nums_config;

public:
StatementGenerator(ClientContext &context);
26 changes: 20 additions & 6 deletions src/random_nums_config.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
#include "random_nums_config.hpp"

namespace duckdb {
void getConfigFromFile(duckdb_string_t file_path) {

RandomNumsConfig::RandomNumsConfig() {

}

}
RandomNumsConfig::~RandomNumsConfig() {
}

// set default values
void GetDefaultConfig() {

}

void RandomNumsConfig::GetConfigFromFile(duckdb_string_t file_path) {

}

// set default values
void RandomNumsConfig::GetDefaultConfig() {
idx_t select_percentage = 60;
idx_t attach_percentage = 40;
idx_t attach_use_percentage = 50;
idx_t detach_percentage = 60;
idx_t set_percentage = 30;
idx_t delete_percentage = 40;
}
}
1 change: 1 addition & 0 deletions src/statement_generator.cpp
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@
#include "duckdb/parser/statement/set_statement.hpp"
#include "duckdb/parser/statement/update_statement.hpp"
#include "duckdb/parser/tableref/list.hpp"
#include "random_nums_config.hpp"

namespace duckdb {