Skip to content

Commit

Permalink
Merge branch 'main' into point-duckdb-version
Browse files Browse the repository at this point in the history
  • Loading branch information
hmeriann committed Jul 2, 2024
2 parents 87b5eab + 4a6da30 commit f4fd988
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/MainDistributionPipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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' }}
20 changes: 15 additions & 5 deletions src/statement_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ unique_ptr<SetStatement> StatementGenerator::GenerateSet() {
name_expr = make_uniq<ConstantExpression>(Value(name));
}
auto set = make_uniq<SetVariableStatement>("schema", std::move(name_expr), SetScope::AUTOMATIC);
return set;
return unique_ptr_cast<duckdb::SetVariableStatement, duckdb::SetStatement>(std::move(set));
}

unique_ptr<MultiStatement> StatementGenerator::GenerateAttachUse() {
Expand Down Expand Up @@ -517,9 +517,19 @@ unique_ptr<TableRef> StatementGenerator::GenerateSubqueryRef() {
}

unique_ptr<TableRef> StatementGenerator::GenerateTableFunctionRef() {
auto function = make_uniq<TableFunctionRef>();
auto &table_function_ref = Choose(generator_context->table_functions);
auto &entry = table_function_ref.get().Cast<TableFunctionCatalogEntry>();
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;
random_val %= num_table_functions;
if (random_val == original_val) {
throw InternalException("No table_functions to test.");
}
table_function_ref = &generator_context->table_functions[random_val];
}
auto &entry = table_function_ref->get().Cast<TableFunctionCatalogEntry>();
auto table_function = entry.functions.GetFunctionByOffset(RandomValue(entry.functions.Size()));

auto result = make_uniq<TableFunctionRef>();
Expand Down Expand Up @@ -1201,7 +1211,7 @@ string StatementGenerator::RandomString(idx_t length) {

const string charset = "$_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
string result = "";
for (int i = 0; i < length; ++i) {
for (idx_t i = 0; i < length; ++i) {
int randomIndex = RandomValue(charset.length());
result += charset[randomIndex];
}
Expand Down

0 comments on commit f4fd988

Please sign in to comment.