Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 6 additions & 6 deletions .github/workflows/MainDistributionPipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ concurrency:
jobs:
duckdb-stable-build:
name: Build extension binaries
uses: duckdb/extension-ci-tools/.github/workflows/_extension_distribution.yml@v1.4.0
uses: duckdb/extension-ci-tools/.github/workflows/_extension_distribution.yml@main
with:
extension_name: sqlsmith
duckdb_version: v1.4.0
ci_tools_version: v1.4.0
duckdb_version: e3509341f681c4cb6f2c22d1f0f4b653ed20644d
ci_tools_version: main
exclude_archs: ''

duckdb-stable-deploy:
name: Deploy extension binaries
needs: duckdb-stable-build
uses: duckdb/extension-ci-tools/.github/workflows/_extension_deploy.yml@v1.4.0
uses: duckdb/extension-ci-tools/.github/workflows/_extension_deploy.yml@main
secrets: inherit
with:
extension_name: sqlsmith
duckdb_version: v1.4.0
ci_tools_version: v1.4.0
duckdb_version: e3509341f681c4cb6f2c22d1f0f4b653ed20644d
ci_tools_version: main
exclude_archs: ''
deploy_latest: ${{ startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' }}
2 changes: 1 addition & 1 deletion .github/workflows/TestDebug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

- name: Dependencies
shell: bash
run: sudo apt-get update -y -qq && sudo apt-get install -y -qq ninja-build ccache
run: sudo apt-get update -y -qq && sudo apt-get install -y -qq ninja-build ccache mold

- uses: actions/checkout@v4
with:
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/test-fuzzer-ci-still-works.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: Build DuckDB
uses: duckdblabs/duckdb-fuzzer-ci/.github/workflows/build_fuzzer.yml@main
with:
git_url: ${{ github.actor }}/duckdb_sqlsmith
git_url: ${{ github.actor }}/duckdb-sqlsmith
git_tag: ${{ github.head_ref }}
timeout-minutes: 120

Expand All @@ -37,4 +37,7 @@ jobs:
data: ${{ matrix.data }}
timeout-minutes: 20
max_queries: 10
enable_verification: ${{ matrix.enable_verification }}
enable_verification: ${{ matrix.enable_verification }}
repo: ${{ github.repository }}
secrets:
DUCKDB_HASH: ${{ needs.build-duckdb.outputs.hash }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ scripts/__pycache__/
test/python/__pycache__/
.Rhistory
.vscode
.cache
2 changes: 1 addition & 1 deletion duckdb
Submodule duckdb updated 5503 files
2 changes: 1 addition & 1 deletion extension-ci-tools
Submodule extension-ci-tools updated 34 files
+61 −27 .github/workflows/TestCITools.yml
+32 −12 .github/workflows/_extension_deploy.yml
+144 −53 .github/workflows/_extension_distribution.yml
+8 −2 README.md
+50 −12 config/distribution_matrix.json
+20 −0 docker/linux_amd64/Dockerfile
+23 −7 docker/linux_amd64_musl/Dockerfile
+20 −0 docker/linux_arm64/Dockerfile
+109 −0 docker/linux_arm64_musl/Dockerfile
+6 −8 makefiles/c_api_extensions/base.Makefile
+12 −8 makefiles/duckdb_extension.Makefile
+10 −0 makefiles/vcpkg.Makefile
+2 −0 scripts/extbuild/.gitignore
+21 −0 scripts/extbuild/Makefile
+34 −0 scripts/extbuild/README.md
+48 −0 scripts/extbuild/cmd/extbuild/github_event.go
+141 −0 scripts/extbuild/cmd/extbuild/github_event_test.go
+132 −0 scripts/extbuild/cmd/extbuild/logging.go
+13 −0 scripts/extbuild/cmd/extbuild/main.go
+112 −0 scripts/extbuild/cmd/extbuild/matrix.go
+322 −0 scripts/extbuild/cmd/extbuild/matrix_test.go
+19 −0 scripts/extbuild/cmd/extbuild/root.go
+16 −0 scripts/extbuild/go.mod
+18 −0 scripts/extbuild/go.sum
+55 −0 scripts/extbuild/internal/distmatrix/config_test.go
+252 −0 scripts/extbuild/internal/distmatrix/matrix.go
+102 −0 scripts/extbuild/internal/distmatrix/matrix_test.go
+101 −0 scripts/extbuild/internal/distmatrix/output.go
+12 −0 scripts/extbuild/testdata/github/events/extension_template_pull_request.json
+8 −0 scripts/extbuild/testdata/github/events/extension_template_push.json
+6 −0 scripts/extbuild/testdata/github/events/extension_template_unknown.json
+43 −5 scripts/modify_distribution_matrix.py
+0 −11 toolchains/x64-windows-static-md-release-vs2019comp.cmake
+1 −1 vcpkg_ports/vcpkg-cmake/vcpkg.json
12 changes: 1 addition & 11 deletions src/include/statement_generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,11 @@
#include "duckdb.hpp"
#include "duckdb/parser/parsed_data/detach_info.hpp"
#include "duckdb/parser/query_node.hpp"
#include "duckdb/parser/tokens.hpp"

#define TESTING_DIRECTORY_NAME "duckdb_unittest_tempdir"

namespace duckdb {
class SQLStatement;
class SelectStatement;
class InsertStatement;
class UpdateStatement;
class DeleteStatement;
class SetStatement;
class TableRef;
class SelectNode;
class SetOperationNode;
class QueryNode;
class ParsedExpression;
class ResultModifier;
class OrderModifier;
class UpdateSetInfo;
Expand Down
13 changes: 8 additions & 5 deletions src/statement_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,15 +332,15 @@ unique_ptr<QueryNode> StatementGenerator::GenerateQueryNode() {
// single GROUP BY
GroupingSet set;
for (idx_t i = 0; i < group_count; i++) {
set.insert(i);
set.emplace(i);
}
select_node->groups.grouping_sets.push_back(std::move(set));
} else {
// multiple grouping sets
while (true) {
GroupingSet set;
while (true) {
set.insert(RandomValue(group_count));
set.emplace(RandomValue(group_count));
if (RandomPercentage(50)) {
break;
}
Expand Down Expand Up @@ -373,8 +373,9 @@ unique_ptr<QueryNode> StatementGenerator::GenerateQueryNode() {
GenerateCTEs(*setop);
setop->setop_type = Choose<SetOperationType>({SetOperationType::EXCEPT, SetOperationType::INTERSECT,
SetOperationType::UNION, SetOperationType::UNION_BY_NAME});
setop->left = GenerateQueryNode();
setop->right = GenerateQueryNode();
for(idx_t i = 0; i < 2; i++) {
setop->children.push_back(GenerateQueryNode());
}
switch (setop->setop_type) {
case SetOperationType::EXCEPT:
case SetOperationType::INTERSECT:
Expand Down Expand Up @@ -467,7 +468,9 @@ unique_ptr<TableRef> StatementGenerator::GenerateBaseTableRef() {
}
case CatalogType::VIEW_ENTRY: {
auto &view = entry.Cast<ViewCatalogEntry>();
column_count = view.types.size();
view.BindView(context);
auto view_columns = view.GetColumnInfo();
column_count = view_columns->types.size();
break;
}
default:
Expand Down
10 changes: 6 additions & 4 deletions src/statement_simplifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,9 @@ void StatementSimplifier::Simplify(SelectNode &node) {
}

void StatementSimplifier::Simplify(SetOperationNode &node) {
Simplify(node.left);
Simplify(node.right);
for(auto &child : node.children) {
Simplify(child);
}
}

void StatementSimplifier::Simplify(CommonTableExpressionMap &cte) {
Expand All @@ -218,8 +219,9 @@ void StatementSimplifier::Simplify(unique_ptr<QueryNode> &node) {
break;
case QueryNodeType::SET_OPERATION_NODE: {
auto &setop = node->Cast<SetOperationNode>();
SimplifyReplace(node, setop.left);
SimplifyReplace(node, setop.right);
for(auto &child : setop.children) {
SimplifyReplace(node, child);
}
Simplify(setop);
break;
}
Expand Down
15 changes: 7 additions & 8 deletions src/third_party/sqlsmith/duckdb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
#include <regex>

using namespace duckdb;
using namespace std;

static regex e_syntax(".*syntax error at or near .*");
static regex e_internal(".*INTERNAL.*");
static std::regex e_syntax(".*syntax error at or near .*");
static std::regex e_internal(".*INTERNAL.*");

sqlsmith_duckdb_connection::sqlsmith_duckdb_connection(duckdb::DatabaseInstance &database) {
// in-memory database
Expand All @@ -31,7 +30,7 @@ schema_duckdb::schema_duckdb(duckdb::DatabaseInstance &database, bool no_catalog
: sqlsmith_duckdb_connection(database) {
// generate empty TPC-H schema
if (verbose_output)
cerr << "Loading tables...";
std::cerr << "Loading tables...";
auto result = connection->Query("SELECT * FROM sqlite_master WHERE type IN ('table', 'view')");
if (result->HasError()) {
result->ThrowError();
Expand All @@ -44,13 +43,13 @@ schema_duckdb::schema_duckdb(duckdb::DatabaseInstance &database, bool no_catalog
tables.push_back(tab);
}
if (verbose_output)
cerr << "done." << endl;
std::cerr << "done." << std::endl;

if (tables.size() == 0) {
throw std::runtime_error("No tables available in catalog!");
}
if (verbose_output)
cerr << "Loading columns and constraints...";
std::cerr << "Loading columns and constraints...";

for (auto t = tables.begin(); t != tables.end(); ++t) {
result = connection->Query("PRAGMA table_info('" + t->name + "')");
Expand All @@ -66,7 +65,7 @@ schema_duckdb::schema_duckdb(duckdb::DatabaseInstance &database, bool no_catalog
}

if (verbose_output)
cerr << "done." << endl;
std::cerr << "done." << std::endl;

Connection con(database);
auto query_result = con.Query(R"(
Expand Down Expand Up @@ -155,7 +154,7 @@ void sleep_thread(Connection *connection) {

void dut_duckdb::test(const std::string &stmt) {
is_active = true;
thread interrupt_thread(sleep_thread, connection.get());
std::thread interrupt_thread(sleep_thread, connection.get());
auto result = connection->Query(stmt);
is_active = false;
interrupt_thread.join();
Expand Down
30 changes: 14 additions & 16 deletions src/third_party/sqlsmith/dump.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,54 @@
#include "dump.hh"
#include "util.hh"

using namespace std;

std::string graphml_dumper::id(struct prod *p) {
ostringstream os;
std::ostringstream os;
os << pretty_type(p) << "_" << p;
return os.str();
}

graphml_dumper::graphml_dumper(ostream &out) : o(out) {
o << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl
graphml_dumper::graphml_dumper(std::ostream &out) : o(out) {
o << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl
<< "<graphml xmlns=\"http://graphml.graphdrawing.org/xmlns\" "
<< "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
<< "xsi:schemaLocation=\"http://graphml.graphdrawing.org/xmlns "
<< "http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd\">" << endl;
<< "http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd\">" << std::endl;

o << "<key id=\"retries\" for=\"node\" "
"attr.name=\"retries\" attr.type=\"double\" />"
<< endl;
<< std::endl;
o << "<key id=\"label\" for=\"node\" "
"attr.name=\"label\" attr.type=\"string\" />"
<< endl;
<< std::endl;
o << "<key id=\"scope\" for=\"node\" "
"attr.name=\"scope\" attr.type=\"string\" />"
<< endl;
<< std::endl;

o << "<graph id=\"ast\" edgedefault=\"directed\">" << endl;
o << "<graph id=\"ast\" edgedefault=\"directed\">" << std::endl;
}

void graphml_dumper::visit(struct prod *p) {
o << "<node id=\"" << id(p) << "\">";
o << "<data key=\"retries\">" << p->retries << "</data>";
o << "<data key=\"label\">" << pretty_type(p) << "</data>";
o << "<data key=\"scope\">" << p->scope << "</data>";
o << "</node>" << endl;
o << "</node>" << std::endl;
if (p->pprod) {
o << "<edge source=\"" << id(p) << "\" target=\"" << id(p->pprod) << "\"/>";
}
o << endl;
o << std::endl;
}

graphml_dumper::~graphml_dumper() {
o << "</graph></graphml>" << endl;
o << "</graph></graphml>" << std::endl;
}

void ast_logger::generated(prod &query) {
string filename("");
std::string filename("");
filename += "sqlsmith-";
filename += to_string(queries);
filename += std::to_string(queries);
filename += ".xml";
ofstream os(filename);
std::ofstream os(filename);
graphml_dumper visitor(os);
query.accept(&visitor);
queries++;
Expand Down
7 changes: 3 additions & 4 deletions src/third_party/sqlsmith/expr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "impedance.hh"
#include "expr.hh"

using namespace std;
using impedance::matched;

shared_ptr<value_expr> value_expr::factory(prod *p, sqltype *type_constraint) {
Expand All @@ -32,7 +31,7 @@ shared_ptr<value_expr> value_expr::factory(prod *p, sqltype *type_constraint) {
return std::make_shared<column_reference>(p, type_constraint);
else
return std::make_shared<const_expr>(p, type_constraint);
} catch (runtime_error &e) {
} catch (std::runtime_error &e) {
}
p->retry();
return factory(p, type_constraint);
Expand Down Expand Up @@ -101,7 +100,7 @@ shared_ptr<bool_expr> bool_expr::factory(prod *p) {
else
return std::make_shared<exists_predicate>(p);
// return std::make_shared<distinct_pred>(q);
} catch (runtime_error &e) {
} catch (std::runtime_error &e) {
}
p->retry();
return factory(p);
Expand Down Expand Up @@ -178,7 +177,7 @@ const_expr::const_expr(prod *p, sqltype *type_constraint) : value_expr(p), expr(
type = type_constraint ? type_constraint : scope->schema->inttype;

if (type == scope->schema->inttype)
expr = to_string(d100());
expr = std::to_string(d100());
else if (type == scope->schema->booltype)
expr += (d6() > 3) ? scope->schema->true_literal : scope->schema->false_literal;
else if (dynamic_cast<insert_stmt *>(p) && (d6() > 3))
Expand Down
16 changes: 7 additions & 9 deletions src/third_party/sqlsmith/grammar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
#include "schema.hh"
#include "impedance.hh"

using namespace std;

shared_ptr<table_ref> table_ref::factory(prod *p) {
try {
if (p->level < 3 + d6()) {
Expand All @@ -24,7 +22,7 @@ shared_ptr<table_ref> table_ref::factory(prod *p) {
return std::make_shared<table_or_query_name>(p);
else
return std::make_shared<table_sample>(p);
} catch (runtime_error &e) {
} catch (std::runtime_error &e) {
p->retry();
}
return factory(p);
Expand Down Expand Up @@ -92,7 +90,7 @@ shared_ptr<join_cond> join_cond::factory(prod *p, table_ref &lhs, table_ref &rhs
return std::make_shared<expr_join_cond>(p, lhs, rhs);
else
return std::make_shared<simple_join_cond>(p, lhs, rhs);
} catch (runtime_error &e) {
} catch (std::runtime_error &e) {
p->retry();
}
return factory(p, lhs, rhs);
Expand Down Expand Up @@ -206,7 +204,7 @@ select_list::select_list(prod *p) : prod(p) {
do {
shared_ptr<value_expr> e = value_expr::factory(this);
value_exprs.push_back(e);
ostringstream name;
std::ostringstream name;
name << "c" << columns++;
sqltype *t = e->type;
assert(t);
Expand Down Expand Up @@ -310,7 +308,7 @@ query_spec::query_spec(prod *p, struct scope *s, bool lateral) : prod(p), myscop
search = bool_expr::factory(this);

if (d6() > 2) {
ostringstream cons;
std::ostringstream cons;
cons << "limit " << d100() + d100();
limit_clause = cons.str();
}
Expand Down Expand Up @@ -441,7 +439,7 @@ shared_ptr<prod> statement_factory(struct scope *s) {
else if (d6() > 5)
return std::make_shared<common_table_expression>((struct prod *)0, s);
return std::make_shared<query_spec>((struct prod *)0, s);
} catch (runtime_error &e) {
} catch (std::runtime_error &e) {
return statement_factory(s);
}
}
Expand Down Expand Up @@ -473,7 +471,7 @@ common_table_expression::common_table_expression(prod *parent, struct scope *s)
} while (d6() > 3);
try {
query = std::make_shared<query_spec>(this, scope);
} catch (runtime_error &e) {
} catch (std::runtime_error &e) {
retry();
goto retry;
}
Expand Down Expand Up @@ -611,7 +609,7 @@ shared_ptr<when_clause> when_clause::factory(struct merge_stmt *p) {
default:
return std::make_shared<when_clause>(p);
}
} catch (runtime_error &e) {
} catch (std::runtime_error &e) {
p->retry();
}
return factory(p);
Expand Down
Loading
Loading