Add experimental DuckDB backend support#442
Draft
adamziel wants to merge 316 commits into
Draft
Conversation
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.
What it does
Adds an experimental optional
duckdbbackend alongside the existing SQLite path.The default SQLite runtime stays zero-dependency. DuckDB is only selected when
DB_ENGINE=duckdband the DuckDB PHP client autoloader is supplied throughDUCKDB_PHP_AUTOLOAD.Rationale
DuckDB gives the project a second SQL execution backend for local development, compatibility experiments, and analytical-style database work. It has different runtime requirements from SQLite, so the implementation is explicitly gated behind runtime checks for PHP/FFI/client availability.
This PR keeps unsupported MySQL behavior explicit: unsupported statements fail through
WP_DuckDB_Driver_Exceptioninstead of silently pretending to work.Implementation
Adds the DuckDB driver under
packages/mysql-on-sqlite/src/duckdb:wpdbquery shapesinformation_schema,SHOW,DESCRIBE, indexes, constraints, and table status queriesDB_ENGINE=duckdbThe DuckDB path remains experimental. The SQLite path remains the default runtime.
Testing instructions
Default suite:
Coding standards:
Live DuckDB suite, with a DuckDB PHP autoloader installed separately:
cd packages/mysql-on-sqlite WP_DUCKDB_TESTS=1 \ WP_DUCKDB_AUTOLOAD=/path/to/duckdb/vendor/autoload.php \ DUCKDB_PHP_AUTOLOAD=/path/to/duckdb/vendor/autoload.php \ php -d ffi.enable=1 ./vendor/bin/phpunit -c ./phpunit.xml.dist --group duckdbCurrent status
Current PR head:
21d5965.Verified locally:
composer check-cs -- --no-cache --report-full --report-checkstyle=./phpcs-report.xmlWP_DUCKDB_TESTS=1 ... php -d ffi.enable=1 packages/mysql-on-sqlite/vendor/bin/phpunit -c packages/mysql-on-sqlite/phpunit.xml.dist --group duckdbGitHub status at this update:
CS: passing on21d5965MySQL Proxy Tests: passing on21d5965Verify release metadata: passing on21d5965