Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Mytherin
Copy link
Collaborator

@Mytherin Mytherin commented Jun 23, 2021

This PR adds an example of using an alternative execution engine with DuckDB. The essence of it is that we create some tables inside DuckDB, and then use the new ExtractPlan function to receive a fully bound and (potentially) optimized logical plan from any query we want to fire. We then have a transformer phase that transforms DuckDB's logical plan to our own (custom) physical plan and execute that plan.

Simplified/shortened code snippet:

 class MyNode {
 public:
 	virtual ~MyNode() {
 	}
 	virtual vector<int> GetNextRow() = 0;

 	unique_ptr<MyNode> child;
 };

 class MyPlanGenerator {
 public:
 	unique_ptr<MyNode> TransformPlan(LogicalOperator &op);
 };

int main() {
	DuckDB db(nullptr);
	Connection con(db);

	con.Query("CREATE TABLE mytable(i INTEGER, j INTEGER)");
	con.Query("CREATE TABLE myothertable(k INTEGER)");

	// extract DuckDB's logical plan
	auto plan = con.ExtractPlan(query);

	// transform the logical plan into our own plan
	MyPlanGenerator generator;
	auto my_plan = generator.TransformPlan(*plan);

	// execute!
	...
}

…ample of an alternate executor based on the logical query plan
@Mytherin
Copy link
Collaborator Author

CC @mbasmanova

@hannes
Copy link
Member

hannes commented Jun 23, 2021

Also CCing @wesm ^^

@Alex-Monahan
Copy link
Contributor

This looks like some interesting stuff... Can't wait to see what folks have in mind!

@Mytherin Mytherin merged commit 94a0cf9 into duckdb:master Jun 23, 2021
@wesm
Copy link

wesm commented Jun 28, 2021

Cool, this will be very helpful to enable interchangeable execution engines.

hawkfish pushed a commit to hawkfish/duckdb that referenced this pull request Oct 20, 2025
* Add a translation layer for UTC offset syntax to equivalent Olson IDs

fixes: duckdb/duckdb-wasm#1897
hawkfish added a commit to hawkfish/duckdb that referenced this pull request Oct 21, 2025
hannes added a commit that referenced this pull request Oct 24, 2025
* Add a translation layer for UTC offset syntax to equivalent Olson IDs

fixes: duckdb/duckdb-wasm#1897
github-actions bot pushed a commit to duckdb/duckdb-r that referenced this pull request Oct 28, 2025
CI Fix: clear benchmark cache between runs (duckdb/duckdb#19508)
vfs integration tests p2 - update (env) vars and tests (duckdb/duckdb#19428)
[Compression] Fix issue in ZSTD decompression related to mis-interpreted segment offsets (duckdb/duckdb#19475)
Add tests for nested lambda bindings (duckdb/duckdb#19453)
WASM duckdb/duckdb#1897: UTC Offset Support (duckdb/duckdb#19464)
github-actions bot added a commit to duckdb/duckdb-r that referenced this pull request Oct 28, 2025
CI Fix: clear benchmark cache between runs (duckdb/duckdb#19508)
vfs integration tests p2 - update (env) vars and tests (duckdb/duckdb#19428)
[Compression] Fix issue in ZSTD decompression related to mis-interpreted segment offsets (duckdb/duckdb#19475)
Add tests for nested lambda bindings (duckdb/duckdb#19453)
WASM duckdb/duckdb#1897: UTC Offset Support (duckdb/duckdb#19464)

Co-authored-by: krlmlr <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants