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 39 commits into
base: main
Choose a base branch
from

Conversation

hmeriann
Copy link
Contributor

This PR will replace hardcoded percentages from the fuzzer with values defined in a file, as it mentioned in the #23

Copy link
Collaborator

@Tmonster Tmonster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I don't think the RandomsConfig needs to be a friend class, instead you can make the RandomConfig a member of the StatementGenerator. Ie...

class StatementGenerator {
public:
    RandomsConfig percentage_selector;
}

src/statement_generator.cpp Outdated Show resolved Hide resolved
src/statement_generator.cpp Outdated Show resolved Hide resolved
@hmeriann hmeriann closed this Sep 12, 2024
@hmeriann hmeriann deleted the random-values-from-file branch September 12, 2024 09:19
@hmeriann hmeriann restored the random-values-from-file branch September 12, 2024 09:19
@hmeriann hmeriann reopened this Sep 12, 2024
Copy link
Collaborator

@Tmonster Tmonster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the RandomNumsConfig could be an unorderdered_map<percentages_enum, idx_t> ?

You will have to create an Enum (see duckdb/common/enums/logical_operator_type.hpp for an example).

In the future it will make it easier to manage the percentages, add new ones etc.

src/random_nums_config.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@Tmonster Tmonster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks much better.

looks like you don't use the file handle though.
Now you can start adding more percentages as well if you want. Feel free to create a GitHub actions file that runs the fuzzer with a config file and one without

src/fuzzyduck.cpp Outdated Show resolved Hide resolved
src/include/fuzzyduck.hpp Outdated Show resolved Hide resolved
src/fuzzyduck.cpp Outdated Show resolved Hide resolved
src/random_nums_config.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@Tmonster Tmonster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just the one comment.

also, I can imagine you may end up adding many ENUMS for each case. You can also just create enums like RandomPercentagesEnum::DEFAULT_XX_PERCENT so that your enum library doesn't get insanely big. Eventually the enums in the statement generation code can get their own enums as we continue to work on and expand this functionality

src/include/random_nums_config.hpp Show resolved Hide resolved

};

unordered_map<RandomPercentagesEnum, idx_t> GetDefaultConfig();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the RandomNumsConfig be a class? That should make things easier to maintain in my opinion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants