This section describes how you can get started at developing DataFusion.
For the fastest path to a working local environment, follow these steps from the repository root:
# 1. Install Rust (https://rust-lang.org/tools/install/) and verify the active toolchain with rustup show # 2. Install protoc 3.15+ (see details below) protoc --version # 3. Download test data used by examples and many tests git submodule update --init --recursive # 4. Build the workspace cargo build # 5. Verify that Rust integration tests can be run cargo test -p datafusion --test parquet_integration # 6. Verify that sqllogictests can run cargo test --profile=ci --test sqllogictests
Notes:
rust-toolchain.toml.protoc is required to compile DataFusion from source.The repository's flake.nix provides a Nix development shell. Enter it directly with nix develop, or install and configure direnv and run direnv allow from the repository root to load it automatically.
The repository's .envrc first loads the nearest ancestor .envrc, if one exists, and then loads the shared Nix environment when Nix is installed. Put project-specific direnv settings in .envrc.local. This file is ignored by Git and loaded last so that local settings take precedence.
If you previously kept personal settings in the repository's .envrc, move only those settings to .envrc.local. Do not copy the shared .envrc, as doing so would load the Nix environment twice.
wget https://az792536.vo.msecnd.net/vms/VMBuild_20190311/VirtualBox/MSEdge/MSEdge.Win10.VirtualBox.zip choco install -y git rustup.install visualcpp-build-tools git-bash.exe cargo build
DataFusion has support for dev containers which may be used for developing DataFusion in an isolated environment either locally or remote if desired. Using dev containers for developing DataFusion is not a requirement but is available where doing local development could be tricky such as with Windows and WSL2, those with older hardware, etc.
For specific details on IDE support for dev containers see the documentation for Visual Studio Code, IntelliJ IDEA, Rust Rover, and GitHub Codespaces.
protoc InstallationCompiling DataFusion from sources requires an installed version of the protobuf compiler, protoc.
On most platforms this can be installed from your system's package manager. For example:
# Ubuntu $ sudo apt install -y protobuf-compiler # Fedora $ dnf install -y protobuf-devel # Arch Linux $ pacman -S protobuf # macOS $ brew install protobuf
You will want to verify the version installed is 3.15 or greater, which has support for explicit field presence. Older versions may fail to compile.
$ protoc --version libprotoc 3.15.0
Alternatively a binary release can be downloaded from the Release Page or built from source.
DataFusion is written in Rust and it uses a standard rust toolkit:
rustup update stable DataFusion generally uses the latest stable release of Rust, though it may lag when new Rust toolchains releaserust-toolchain.toml filerustup component add --toolchain 1.99.0 rust-analyzercargo buildcargo fmt to format the codeTesting setup:
git submodule initgit submodule update --init --remote --recursivecargo test to run testsNote that running cargo test requires significant memory resources, due to cargo running many tests in parallel by default. If you run into issues with slow tests or system lock ups, you can significantly reduce the memory required by instead running cargo test -- --test-threads=1. For more information see this issue.
Formatting instructions:
or run them all at once:
Debugging:
The standard dev profile, used by cargo build and cargo test, disables variable-level DWARF debug information that is required by interactive debuggers.
If you need to step through the code with a debugger, build with:
CARGO_PROFILE_DEV_DEBUG=2 cargo build
Alternatively, you can set CARGO_PROFILE_DEV_DEBUG=2 as an environment variable in your IDE.
This enables the additional debug information required for source-level debugging.
For more details, see the DataFusion Cargo.toml configuration.