robust-predicate-transfer

[SIGMOD'25] Source code for the paper: Debunking the Myth of Join Ordering: Toward Robust SQL Analytics

https://github.com/embryo-labs/robust-predicate-transfer

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (6.2%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

[SIGMOD'25] Source code for the paper: Debunking the Myth of Join Ordering: Toward Robust SQL Analytics

Basic Info
Statistics
  • Stars: 20
  • Watchers: 2
  • Forks: 9
  • Open Issues: 0
  • Releases: 0
Archived
Created over 2 years ago · Last pushed 10 months ago
Metadata Files
Readme Contributing License Code of conduct Citation

README.md

About Robust Predicate Transfer

[!NOTE] Archived as of Sep 4th, 2025: A new implementation with a more recent version of DuckDB can be found in this repo.

We integrate Robust Predicate Transfer into DuckDB, when you finish installing DuckDB, you already have Predicate Transfer in it. You can find the code of Predicate Transfer in src/optimizer/predicate_transfer. The interface of Predicate Transfer can be found at optimizer.cpp at line 120-121, 131.

Requirement

Arrow 16.0 for Bloom filter implementation

Code Structure

LogicalBF operators

     src/include/duckdb/planner/operator/logicalcreatebf.hpp
     src/planner/operator/logicalcreatebf.cpp
     src/include/duckdb/planner/operator/logicalusebf.hpp
     src/planner/operator/logicalusebf.cpp

PhysicalBF operators

     src/include/duckdb/execution/operator/persistent/physicalcreatebf.hpp
     src/execution/operator/persistent/physicalcreatebf.cpp
     src/include/duckdb/execution/operator/filter/physicalusebf.hpp
     src/execution/operator/filter/physicalusebf.cpp

LogicalBF to PhysicalBF

     src/execution/physicalplan/plancreatebf.cpp
     src/execution/physical
plan/planusebf.cpp

Predicate Transfer Optimizer

     src/optimizer/predicatetransfer
         src/optimizer/predicate
transfer/bloomfilter: Bloom filter implementation
             src/optimizer/predicate
transfer/bloomfilter/bloomfilteravx2.cpp: Bloom filter AVX2 version
             src/optimizer/predicate
transfer/bloomfilter/bloomfilterusekernel.cpp: Bloom filter probe interface
             src/optimizer/predicatetransfer/bloomfilter/bloomfilter.cpp: Bloom filter core implementation
         src/optimizer/predicate
transfer/dagmanager.cpp: build DAG from query graph
         src/optimizer/predicate
transfer/dag.cpp: DAG implementation
         src/optimizer/predicatetransfer/nodesmanager.cpp: Node manager
         src/optimizer/predicatetransfer/predicatetransfer_optimizer.cpp: Insert LogicalBF operators into the logical plan

Configuration

The configuration setting of Robust Predicate Transfer can be found in /src/include/duckdb/optimizer/predicate_transfer/setting.hpp file. Once you change the configuration, you have to recompile the whole project.

If you want to use the original DuckDB, comment all lines;
If you want to use the DuckDB with Bloom Join optimized, uncomment line 2 (#define BloomJoin);
If you want to use the original Predicate Transfer (CIDR2024 version), uncomment line 3 (#define PredicateTransfer) and line 10 (#define SmalltoLarge);
If you want to use the Robust Predicate Transfer, only uncomment line 3 (#define PredicateTransfer).

To generate the left-deep cost-based plan, use #define ExactLeftDeep.
To generate random left deep join orders, use #define RandomLeftDeep.
To generate random bushy join orders, use #define RandomBushy.

To enable intermediate result spill to disk, use #define External.

Benchmark

We test TPC-H, JOB, TPC-DS, and DSB. TPC-H and TPC-DS are downloaded from the TPC website. JOB is downloaded from https://github.com/danolivo/jo-bench. DSB is downloaded from https://github.com/microsoft/dsb. The queries we used can be found in TPCH.sql, JOB.sql, and ./tpc-ds (DSB uses the same queries).
We add the scripts we used to measure the execution time in /testscripts. JOB and TPC-H share that same script, and TPC-DS and DSB use another one.
For JOB and TPC-H, compile main.cpp by Cmake and make and run the output file "./test". A "result.txt" file will be generated in the same directory and records the time. We achieve this by modifying the C++ API code of DuckDB. You can find the relevant code in client
context.cpp line 808-810 and 859-871.
For TPC-DS and DSB, compile main.cpp and run run.sh. A "result.txt" file will be generated as well.

About DuckDB

DuckDB is a high-performance analytical database system. It is designed to be fast, reliable, portable, and easy to use. DuckDB provides a rich SQL dialect, with support far beyond basic SQL. DuckDB supports arbitrary and nested correlated subqueries, window functions, collations, complex types (arrays, structs), and more. For more information on using DuckDB, please refer to the DuckDB documentation.

Installation

First, download the project and enter the root directory (I use gcc/g++ to compile) cd PredTransDuckDB Then, use cmake cmake -B build -S . At last, build the project in ./build cd build cmake --build .

Reproduction Example

Step 1: Acquire the TPC-H/JOB/TPC-DS/DSB.
Step 2: Change the /src/include/duckdb/optimizer/predicatetransfer/setting.hpp: use #define PredicateTransfer and #define RandomLeftDeep / RandomBushy. This tests the RPT join order robustness.
Step 3: Cmake and Make the project.
Step 4: Cmake and Make ./test
scripts/JOB&TPCH/ (or ./testscripts/TPCDS/).
Step 5: Run ./test (or run.sh). The result will be recorded in result.txt under the current directory.
Step 6: Change the /src/include/duckdb/optimizer/predicate
transfer/setting.hpp: use #define RandomLeftDeep / RandomBushy and comment #define PredicateTransfer. This tests the DuckDB join order robustness. Step 7: Repeat Step 3-5.

Owner

  • Name: embryo-labs
  • Login: embryo-labs
  • Kind: organization

GitHub Events

Total
  • Watch event: 13
  • Push event: 2
  • Fork event: 5
Last Year
  • Watch event: 13
  • Push event: 2
  • Fork event: 5

Dependencies

.github/actions/build_extensions/action.yml actions
  • lukka/run-vcpkg v11.1 composite
.github/actions/manylinux_2014_setup/action.yml actions
  • hendrikmuhs/ccache-action main composite
  • lukka/run-vcpkg v11.1 composite
.github/actions/swap_space/action.yml actions
.github/actions/ubuntu_18_setup/action.yml actions
  • actions/checkout v3 composite
  • hendrikmuhs/ccache-action main composite
  • lukka/run-vcpkg v11.1 composite
.github/workflows/CodeQuality.yml actions
  • actions/checkout v3 composite
  • hendrikmuhs/ccache-action main composite
.github/workflows/DraftMe.yml actions
  • actions/upload-artifact v3 composite
.github/workflows/DraftMeNot.yml actions
.github/workflows/DraftPR.yml actions
  • actions/github-script v6 composite
.github/workflows/ExtendedTests.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • hendrikmuhs/ccache-action main composite
.github/workflows/ExtensionTrigger.yml actions
  • actions/checkout v3 composite
.github/workflows/ExtraTests.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • hendrikmuhs/ccache-action main composite
.github/workflows/InternalIssuesCreateMirror.yml actions
.github/workflows/InternalIssuesUpdateMirror.yml actions
.github/workflows/IssuesCloseStale.yml actions
  • actions/stale v8 composite
.github/workflows/Java.yml actions
  • ./.github/actions/manylinux_2014_setup * composite
  • ./.github/actions/ubuntu_18_setup * composite
  • actions/checkout v3 composite
  • actions/download-artifact v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • hendrikmuhs/ccache-action main composite
.github/workflows/Julia.yml actions
  • actions/checkout v3 composite
  • hendrikmuhs/ccache-action main composite
  • julia-actions/setup-julia v1 composite
.github/workflows/Labels.yml actions
  • andymckay/labeler master composite
.github/workflows/LinuxRelease.yml actions
  • ./.github/actions/build_extensions * composite
  • ./.github/actions/manylinux_2014_setup * composite
  • ./.github/actions/ubuntu_18_setup * composite
  • KyleMayes/install-llvm-action v1 composite
  • actions/checkout v3 composite
  • actions/download-artifact v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • hendrikmuhs/ccache-action main composite
.github/workflows/Main.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • hendrikmuhs/ccache-action main composite
.github/workflows/NeedsDocumentation.yml actions
.github/workflows/NightlyTests.yml actions
  • ./.github/actions/manylinux_2014_setup * composite
  • ./.github/actions/ubuntu_18_setup * composite
  • KyleMayes/install-llvm-action v1 composite
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • hendrikmuhs/ccache-action main composite
  • mymindstorm/setup-emsdk v12 composite
.github/workflows/OSX.yml actions
  • ./.github/actions/build_extensions * composite
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • hendrikmuhs/ccache-action main composite
.github/workflows/PRNeedsMaintainerApproval.yml actions
.github/workflows/Python.yml actions
  • ./.github/actions/build_extensions * composite
  • ./.github/actions/manylinux_2014_setup * composite
  • actions/checkout v3 composite
  • actions/download-artifact v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • docker/setup-qemu-action v2 composite
  • hendrikmuhs/ccache-action main composite
.github/workflows/R.yml actions
  • ./.github/actions/build_extensions * composite
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • hendrikmuhs/ccache-action main composite
  • r-lib/actions/setup-r v2 composite
.github/workflows/R_CMD_CHECK.yml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/Regression.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • hendrikmuhs/ccache-action main composite
.github/workflows/Swift.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/SwiftRelease.yml actions
  • actions/checkout v3 composite
.github/workflows/Wasm.yml actions
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • hendrikmuhs/ccache-action main composite
  • lukka/run-vcpkg v11.1 composite
  • mymindstorm/setup-emsdk v12 composite
.github/workflows/Windows.yml actions
  • ./.github/actions/build_extensions * composite
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • hendrikmuhs/ccache-action main composite
  • ilammy/msvc-dev-cmd v1 composite
  • msys2/setup-msys2 v2 composite
.github/workflows/_extension_client_tests.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/_extension_deploy.yml actions
  • actions/checkout v3 composite
  • actions/download-artifact v2 composite
.github/workflows/_extension_distribution.yml actions
  • ./duckdb/.github/actions/ubuntu_18_setup * composite
  • actions/checkout v3 composite
  • actions/setup-python v2 composite
  • actions/upload-artifact v2 composite
  • actions/upload-artifact v3 composite
  • hendrikmuhs/ccache-action main composite
  • lukka/run-vcpkg v11.1 composite
  • mymindstorm/setup-emsdk v13 composite
  • r-lib/actions/setup-r v2 composite
.github/workflows/cifuzz.yml actions
  • actions/upload-artifact v1 composite
  • google/oss-fuzz/infra/cifuzz/actions/build_fuzzers master composite
  • google/oss-fuzz/infra/cifuzz/actions/run_fuzzers master composite