From c843226d84f79fa7ce99576ae8605ecef1a28484 Mon Sep 17 00:00:00 2001 From: comphead Date: Wed, 31 Jan 2024 13:51:58 -0800 Subject: [PATCH] doc: Add example how to include latest datafusion (#9076) * doc: Add example how to include latest datafusion * rm unused block * Update docs/source/user-guide/example-usage.md Co-authored-by: Andrew Lamb --------- Co-authored-by: Andrew Lamb --- docs/source/user-guide/example-usage.md | 27 +++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/docs/source/user-guide/example-usage.md b/docs/source/user-guide/example-usage.md index 77b196c124c5..fd525608d3e1 100644 --- a/docs/source/user-guide/example-usage.md +++ b/docs/source/user-guide/example-usage.md @@ -23,7 +23,7 @@ In this example some simple processing is performed on the [`example.csv`](https Even [`more code examples`](https://github.com/apache/arrow-datafusion/tree/main/datafusion-examples) attached to the project. -## Update `Cargo.toml` +## Add DataFusion as a dependency Find latest available Datafusion version on [DataFusion's crates.io] page. Add the dependency to your `Cargo.toml` file: @@ -33,6 +33,29 @@ datafusion = "31" tokio = "1.0" ``` +## Add DataFusion latest codebase as a dependency + +Cargo supports adding dependency directly from Github which allows testing out latest DataFusion codebase without waiting the code to be released to crates.io +according to the [DataFusion release schedule](https://github.com/apache/arrow-datafusion/blob/main/dev/release/README.md#release-process) + +```toml +datafusion = { git = "https://github.com/apache/arrow-datafusion", branch = "main"} +``` + +Also it works on the package level + +```toml +datafusion-common = { git = "https://github.com/apache/arrow-datafusion", branch = "main", package = "datafusion-common"} +``` + +And with features + +```toml +datafusion = { git = "https://github.com/apache/arrow-datafusion", branch = "main", default-features = false, features = ["unicode_expressions"] } +``` + +More on [Cargo dependencies](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#specifying-dependencies) + ## Run a SQL query against data stored in a CSV: ```rust @@ -239,7 +262,7 @@ like error backtrace. To enable a backtrace you need to add Datafusion `backtrac datafusion = { version = "31.0.0", features = ["backtrace"]} ``` -Set environment [`variables`] https://doc.rust-lang.org/std/backtrace/index.html#environment-variables +Set environment [variables](https://doc.rust-lang.org/std/backtrace/index.html#environment-variables) ```bash RUST_BACKTRACE=1 ./target/debug/datafusion-cli