Initial version of DuckDB engine for MariaDB based on DuckDB 1.5.2.#4903
Conversation
Basic INSERT,SELECT functionality works now.
…o MariaDB row properly.
…ks DuckDB parser + various fixes to pass currently enabled tests
DuckDB with MariaDB-specific patches (octet_length VARCHAR overload) is now a proper git submodule at third_parties/duckdb.
…rted join syntax.
…tions tests issues.
9a7e265 to
7081508
Compare
There was a problem hiding this comment.
Pull request overview
This PR lays groundwork for integrating the DuckDB storage engine into MariaDB by adding build-system scaffolding for storage/duckdb, wiring Debian/source-dist packaging hooks, and exposing condition-extraction helpers from the optimizer for external consumers (e.g., engine pushdown).
Changes:
- Add
storage/duckdb/CMake integration that fetches DuckDB engine sources at configure time and installs its MTR tests. - Update Debian autobake script and source distribution generation to include DuckDB plugin packaging inputs.
- Export
make_cond_for_table*()declarations (and make their definitions non-static) for use outsidesql_select.cc.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
storage/duckdb/CMakeLists.txt |
Adds FetchContent-based integration and packaging-related CPack propagation for DuckDB engine plugin |
storage/duckdb/.gitignore |
Ignores fetched DuckDB sources directory |
sql/sql_select.h |
Exposes make_cond_for_table*() declarations in a public header |
sql/sql_select.cc |
Makes make_cond_for_table*() non-static so they can be linked from other compilation units |
debian/autobake-deb.sh |
Attempts to enable DuckDB plugin Debian packaging during autobake |
cmake/make_dist.cmake.in |
Adds extra git export step intended to include DuckDB submodule content in source tarballs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ns for other MariaDB engines.
* don't bother merging libraries * gitignore the build dir * prefix dir = build dir * produce the progress log while building
error: struct 'THD' was previously declared as a class; this is valid, but may result in linker errors under the Microsoft C++ ABI [-Werror,-Wmismatched-tags] error: struct 'Item' was previously declared as a class; this is valid, but may result in linker errors under the Microsoft C++ ABI [-Werror,-Wmismatched-tags]
and fix the version
no additional depencenies = server component
|
|
DuckDB Storage Engine for MariaDB
Overview
This PR introduces DuckDB 1.5.2 as an embedded analytical (OLAP) storage engine plugin for MariaDB 11.4. The engine is ported from AliSQL's DuckDB integration and fully adapted to MariaDB's handler API, plugin system, build infrastructure, and packaging conventions. It ships as a loadable module (
ha_duckdb.so) for x86_64 and ARM64 architectures.Architecture
The engine is structured as a git submodule at storage/duckdb/duckdb (repo:
drrtuy/duckdb-engine), which itself contains a nested submodule (third_parties/duckdb) pointing to a DuckDB 1.3.2 fork with MariaDB-specific patches (e.g.octet_lengthVARCHAR overload). DuckDB is built statically with all builtin extensions (ICU, JSON, Parquet, jemalloc, etc.) and linked into a singleha_duckdb.soplugin. A debug-STL ABI mismatch guard (-U_GLIBCXX_DEBUG -U_GLIBCXX_ASSERTIONS) is applied in debug builds to preventSIGSEGVfromsizeof(std::vector)divergence between the plugin and the server.Supported Operations
CREATE TABLE,DROP TABLE,ALTER TABLE,RENAME TABLE— SQL is translated from MariaDB's internal structures to DuckDB-dialect DDL via ddl_convertor.cc, including expression defaults, column types, and engine conversions (ALTER TABLE ... ENGINE=DuckDB).select_handlerinterface (ha_duckdb_pushdown.cc), with result-set conversion back to MariaDB row format (duckdb_select.cc).DuckdbThdContextmanaged viathd_get_ha_data/thd_set_ha_data(replacing AliSQL'sTHD::get_duckdb_context()).Packaging
mariadb-plugin-duckdbforamd64andarm64.postinst/prermhooks automatically runinstall.sql/uninstall.sqlto register or unregister the plugin when the server is running.PLUGIN_DUCKDB=NOby default in native Debian builds (debian/rules); enabled automatically byautobake-deb.shfor MariaDB.org release builds when the submodule is present.Testing
An MTR test suite is included under
mysql-test/plugin/duckdb/covering DDL, DML, type conversions, ALTER operations, and basic query pushdown scenarios. Adisable.deffile documents tests that are not yet passing or are intentionally skipped.Key Differences from AliSQL Port
dd::Table,dd::Schema) dependency — table metadata comes fromTABLE*and.frm/TABLE_SHARE.mysql_declare_pluginwithmaria_declare_plugin.dd::Table*parameters).Relay_log_infoextensions (not applicable to MariaDB).DB_TYPE_AUTOASSIGNinstead of the AliSQL-specificDB_TYPE_DUCKDBenum.