Skip to content

Commit 02abb22

Browse files
committed
Random index generating is fixed
1 parent 53453b7 commit 02abb22

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/statement_generator.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -517,11 +517,13 @@ unique_ptr<TableRef> StatementGenerator::GenerateSubqueryRef() {
517517
}
518518

519519
unique_ptr<TableRef> StatementGenerator::GenerateTableFunctionRef() {
520-
auto original_val = generator_context->table_functions.size();
521-
auto random_val = RandomValue(original_val);
520+
auto num_table_functions = generator_context->table_functions.size();
521+
auto random_val = RandomValue(num_table_functions);
522+
auto original_val = random_val;
522523
auto table_function_ref = &generator_context->table_functions[random_val];
523524
while (table_function_ref->get().type == CatalogType::TABLE_MACRO_ENTRY) {
524-
random_val += 1 % original_val;
525+
random_val += 1;
526+
random_val %= num_table_functions;
525527
if (random_val == original_val) {
526528
throw InternalException("No table_functions to test.");
527529
}

0 commit comments

Comments
 (0)