From be15f396d38d22395608150be000a2f22d67f195 Mon Sep 17 00:00:00 2001 From: Zuleykha Pavlichenkova Date: Tue, 25 Jun 2024 14:30:15 +0200 Subject: [PATCH 1/6] avoid CatalogType::TABLE_MACRO_ENTRY, which causes SIGABRT --- src/statement_generator.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/statement_generator.cpp b/src/statement_generator.cpp index 3d0b975..62c59e9 100644 --- a/src/statement_generator.cpp +++ b/src/statement_generator.cpp @@ -517,9 +517,13 @@ unique_ptr StatementGenerator::GenerateSubqueryRef() { } unique_ptr StatementGenerator::GenerateTableFunctionRef() { - auto function = make_uniq(); - auto &table_function_ref = Choose(generator_context->table_functions); - auto &entry = table_function_ref.get().Cast(); + auto original_val = generator_context->table_functions.size(); + auto random_fun = RandomValue(original_val); + auto table_function_ref = &generator_context->table_functions[random_fun]; + while (table_function_ref->get().type == CatalogType::TABLE_MACRO_ENTRY) { + table_function_ref = &generator_context->table_functions[RandomValue(original_val)]; + } + auto &entry = table_function_ref->get().Cast(); auto table_function = entry.functions.GetFunctionByOffset(RandomValue(entry.functions.Size())); auto result = make_uniq(); From 4a85d595695906d5925fdbc9add3c186fc71e4e4 Mon Sep 17 00:00:00 2001 From: Zuleykha Pavlichenkova Date: Tue, 25 Jun 2024 14:52:38 +0200 Subject: [PATCH 2/6] Fixed duckdb version on MainDistributionPipeline.yml to last and main --- .github/workflows/MainDistributionPipeline.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/MainDistributionPipeline.yml b/.github/workflows/MainDistributionPipeline.yml index 14214e9..a88fc9c 100644 --- a/.github/workflows/MainDistributionPipeline.yml +++ b/.github/workflows/MainDistributionPipeline.yml @@ -14,9 +14,9 @@ concurrency: jobs: duckdb-stable-build: name: Build extension binaries - uses: duckdb/extension-ci-tools/.github/workflows/_extension_distribution.yml@v0.10.3 + uses: duckdb/extension-ci-tools/.github/workflows/_extension_distribution.yml@v1.0.0 with: - duckdb_version: v0.10.3 + duckdb_version: main extension_name: sqlsmith duckdb-stable-deploy: @@ -25,6 +25,6 @@ jobs: uses: ./.github/workflows/_extension_deploy.yml secrets: inherit with: - duckdb_version: v0.10.3 + duckdb_version: main extension_name: sqlsmith deploy_latest: ${{ startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' }} From d97b1ad7503bedb862252dc58cdd86e4a97e8fb8 Mon Sep 17 00:00:00 2001 From: Zuleykha Pavlichenkova Date: Tue, 25 Jun 2024 15:41:02 +0200 Subject: [PATCH 3/6] src/statement_generator.cpp --- src/statement_generator.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/statement_generator.cpp b/src/statement_generator.cpp index 62c59e9..5bbc123 100644 --- a/src/statement_generator.cpp +++ b/src/statement_generator.cpp @@ -518,9 +518,13 @@ unique_ptr StatementGenerator::GenerateSubqueryRef() { unique_ptr StatementGenerator::GenerateTableFunctionRef() { auto original_val = generator_context->table_functions.size(); - auto random_fun = RandomValue(original_val); - auto table_function_ref = &generator_context->table_functions[random_fun]; - while (table_function_ref->get().type == CatalogType::TABLE_MACRO_ENTRY) { + auto random_val = RandomValue(original_val); + auto table_function_ref = &generator_context->table_functions[random_val]; + while (table_function_ref->get().type == CatalogType::TABLE_MACRO_ENTRY) { + random_val +=1 % generator_context->table_functions.size(); + if (random_val == original_val) { + throw InternalException("No table_functions to test."); + } table_function_ref = &generator_context->table_functions[RandomValue(original_val)]; } auto &entry = table_function_ref->get().Cast(); From 0fa32b399a2252e0bff39d1b28e6371c24d4c3a7 Mon Sep 17 00:00:00 2001 From: Zuleykha Pavlichenkova Date: Tue, 25 Jun 2024 15:48:04 +0200 Subject: [PATCH 4/6] rename random_fun to random_val and changes according to the change request --- src/statement_generator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/statement_generator.cpp b/src/statement_generator.cpp index 5bbc123..d7e5a55 100644 --- a/src/statement_generator.cpp +++ b/src/statement_generator.cpp @@ -521,7 +521,7 @@ unique_ptr StatementGenerator::GenerateTableFunctionRef() { auto random_val = RandomValue(original_val); auto table_function_ref = &generator_context->table_functions[random_val]; while (table_function_ref->get().type == CatalogType::TABLE_MACRO_ENTRY) { - random_val +=1 % generator_context->table_functions.size(); + random_val += 1 % original_val; if (random_val == original_val) { throw InternalException("No table_functions to test."); } From 53453b7cbf0240ff8d9d8e275c37c0e614bf8806 Mon Sep 17 00:00:00 2001 From: Zuleykha Pavlichenkova Date: Tue, 25 Jun 2024 16:21:12 +0200 Subject: [PATCH 5/6] use random_val instead of generating a random one again --- src/statement_generator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/statement_generator.cpp b/src/statement_generator.cpp index d7e5a55..3804744 100644 --- a/src/statement_generator.cpp +++ b/src/statement_generator.cpp @@ -525,7 +525,7 @@ unique_ptr StatementGenerator::GenerateTableFunctionRef() { if (random_val == original_val) { throw InternalException("No table_functions to test."); } - table_function_ref = &generator_context->table_functions[RandomValue(original_val)]; + table_function_ref = &generator_context->table_functions[random_val]; } auto &entry = table_function_ref->get().Cast(); auto table_function = entry.functions.GetFunctionByOffset(RandomValue(entry.functions.Size())); From 02abb2218a2a93420326caa7001a34f138f35754 Mon Sep 17 00:00:00 2001 From: Zuleykha Pavlichenkova Date: Thu, 27 Jun 2024 22:42:19 +0200 Subject: [PATCH 6/6] Random index generating is fixed --- src/statement_generator.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/statement_generator.cpp b/src/statement_generator.cpp index 3804744..0f87733 100644 --- a/src/statement_generator.cpp +++ b/src/statement_generator.cpp @@ -517,11 +517,13 @@ unique_ptr StatementGenerator::GenerateSubqueryRef() { } unique_ptr StatementGenerator::GenerateTableFunctionRef() { - auto original_val = generator_context->table_functions.size(); - auto random_val = RandomValue(original_val); + auto num_table_functions = generator_context->table_functions.size(); + auto random_val = RandomValue(num_table_functions); + auto original_val = random_val; auto table_function_ref = &generator_context->table_functions[random_val]; while (table_function_ref->get().type == CatalogType::TABLE_MACRO_ENTRY) { - random_val += 1 % original_val; + random_val += 1; + random_val %= num_table_functions; if (random_val == original_val) { throw InternalException("No table_functions to test."); }