Open
Conversation
DuckDB engine is available for x86_64 and ARM64.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DuckDB Storage Engine for MariaDB
Overview
This PR introduces DuckDB 1.3.2 as an embedded analytical (OLAP) storage engine plugin for MariaDB 12.3. 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.