Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-39234

DuckDB as a storage engine

    XMLWordPrintable

Details

    • New Feature
    • Status: Stalled (View Workflow)
    • Major
    • Resolution: Unresolved
    • 13.0
    • None

    Description

      This is based on https://github.com/MariaDB/server/pull/4830.

      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](cci:9://file:///git/mdb-12/storage/duckdb/duckdb:0:0-0:0) (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_length VARCHAR overload). DuckDB is built statically with all builtin extensions (ICU, JSON, Parquet, jemalloc, etc.) and linked into a single ha_duckdb.so plugin. A debug-STL ABI mismatch guard (-U_GLIBCXX_DEBUG -U_GLIBCXX_ASSERTIONS) is applied in debug builds to prevent SIGSEGV from `sizeof(std::vector)` divergence between the plugin and the server.

      Supported Operations

      Packaging

      • New Debian package `mariadb-plugin-duckdb` for `amd64` and `arm64`.
      • `postinst` / `prerm` hooks automatically run `install.sql` / `uninstall.sql` to register or unregister the plugin when the server is running.
      • `PLUGIN_DUCKDB=NO` by default in native Debian builds (`debian/rules`); enabled automatically by `autobake-deb.sh` for MariaDB.org release builds when the submodule is present.
      • RPM packaging scaffolding included in the submodule.

      Testing

      An MTR test suite is included under `mysql-test/plugin/duckdb/` covering DDL, DML, type conversions, ALTER operations, and basic query pushdown scenarios. A `disable.def` file documents tests that are not yet passing or are intentionally skipped.

      Key Differences from AliSQL Port

      • Removed MySQL 8 Data Dictionary (`dd::Table`, `dd::Schema`) dependency — table metadata comes from `TABLE*` and `.frm` / `TABLE_SHARE`.
      • Replaced `mysql_declare_plugin` with `maria_declare_plugin`.
      • Adapted all handler method signatures (no `dd::Table*` parameters).
      • Removed partition support, replication batch mode (GTID batch, multi-trx), and `Relay_log_info` extensions (not applicable to MariaDB).
      • Uses `DB_TYPE_AUTOASSIGN` instead of the AliSQL-specific `DB_TYPE_DUCKDB` enum.

      Attachments

        Activity

          People

            gkodinov Georgi Kodinov
            gkodinov Georgi Kodinov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.