Skip to content

Apache DataFusion SQL Query Engine

ARROW-11022: [Rust] Upgrade to Tokio 1.0

Heres, Daniel2a40557128d4
diff --git a/rust/benchmarks/Cargo.toml b/rust/benchmarks/Cargo.toml
index e29fb38d50..9965571001 100644
--- a/rust/benchmarks/Cargo.toml
+++ b/rust/benchmarks/Cargo.toml
@@ -35,7 +35,7 @@ arrow = { path = "../arrow" }
parquet = { path = "../parquet" }
datafusion = { path = "../datafusion" }
structopt = { version = "0.3", default-features = false }
-tokio = { version = "0.2", features = ["macros", "rt-core", "rt-threaded"] }
+tokio = { version = "^1.0", features = ["macros", "rt", "rt-multi-thread"] }
futures = "0.3"
env_logger = "^0.8"
snmalloc-rs = {version = "0.2", optional = true, features= ["cache-friendly"] }
diff --git a/rust/datafusion/Cargo.toml b/rust/datafusion/Cargo.toml
index 8d2816f3e0..2b92216912 100644
--- a/rust/datafusion/Cargo.toml
+++ b/rust/datafusion/Cargo.toml
@@ -59,7 +59,7 @@ chrono = "0.4"
async-trait = "0.1.41"
futures = "0.3"
pin-project-lite= "^0.2.0"
-tokio = { version = "0.2", features = ["macros", "blocking", "rt-core", "rt-threaded", "sync"] }
+tokio = { version = "1.0", features = ["macros", "rt", "rt-multi-thread", "sync"] }
log = "^0.4"
md-5 = "^0.9.1"
sha2 = "^0.9.1"
@@ -69,9 +69,9 @@ ordered-float = "2.0"
rand = "0.8"
criterion = "0.3"
tempfile = "3"
-prost = "0.6"
+prost = "0.7"
arrow-flight = { path = "../arrow-flight", version = "4.0.0-SNAPSHOT" }
-tonic = "0.3"
+tonic = "0.4"
[[bench]]
name = "aggregate_query_sql"
diff --git a/rust/datafusion/benches/aggregate_query_sql.rs b/rust/datafusion/benches/aggregate_query_sql.rs
index 0c6b1cf7b0..c3baa6416d 100644
--- a/rust/datafusion/benches/aggregate_query_sql.rs
+++ b/rust/datafusion/benches/aggregate_query_sql.rs
@@ -44,7 +44,7 @@ pub fn seedable_rng() -> StdRng {
}
fn query(ctx: Arc<Mutex<ExecutionContext>>, sql: &str) {
- let mut rt = Runtime::new().unwrap();
+ let rt = Runtime::new().unwrap();
// execute the query
let df = ctx.lock().unwrap().sql(&sql).unwrap();
diff --git a/rust/datafusion/benches/math_query_sql.rs b/rust/datafusion/benches/math_query_sql.rs
index 04ed29c7fe..54c35d5014 100644
--- a/rust/datafusion/benches/math_query_sql.rs
+++ b/rust/datafusion/benches/math_query_sql.rs
@@ -37,7 +37,7 @@ use datafusion::datasource::MemTable;
use datafusion::execution::context::ExecutionContext;
fn query(ctx: Arc<Mutex<ExecutionContext>>, sql: &str) {
- let mut rt = Runtime::new().unwrap();
+ let rt = Runtime::new().unwrap();
// execute the query
let df = ctx.lock().unwrap().sql(&sql).unwrap();
diff --git a/rust/datafusion/benches/sort_limit_query_sql.rs b/rust/datafusion/benches/sort_limit_query_sql.rs
index 9834bee098..a73a01afba 100644
--- a/rust/datafusion/benches/sort_limit_query_sql.rs
+++ b/rust/datafusion/benches/sort_limit_query_sql.rs
@@ -32,7 +32,7 @@ use datafusion::execution::context::ExecutionContext;
use tokio::runtime::Runtime;
fn query(ctx: Arc<Mutex<ExecutionContext>>, sql: &str) {
- let mut rt = Runtime::new().unwrap();
+ let rt = Runtime::new().unwrap();
// execute the query
let df = ctx.lock().unwrap().sql(&sql).unwrap();
@@ -66,7 +66,7 @@ fn create_context() -> Arc<Mutex<ExecutionContext>> {
)
.unwrap();
- let mut rt = Runtime::new().unwrap();
+ let rt = Runtime::new().unwrap();
let ctx_holder: Arc<Mutex<Vec<Arc<Mutex<ExecutionContext>>>>> =
Arc::new(Mutex::new(vec![]));
diff --git a/rust/datafusion/src/physical_plan/coalesce_batches.rs b/rust/datafusion/src/physical_plan/coalesce_batches.rs
index 1bfcf061b6..812a80477c 100644
--- a/rust/datafusion/src/physical_plan/coalesce_batches.rs
+++ b/rust/datafusion/src/physical_plan/coalesce_batches.rs
@@ -235,7 +235,7 @@ mod tests {
use arrow::array::UInt32Array;
use arrow::datatypes::{DataType, Field, Schema};
- #[tokio::test(threaded_scheduler)]
+ #[tokio::test(flavor = "multi_thread")]
async fn test_concat_batches() -> Result<()> {
let schema = test_schema();
let partition = create_vec_batches(&schema, 10)?;
diff --git a/rust/datafusion/src/physical_plan/repartition.rs b/rust/datafusion/src/physical_plan/repartition.rs
index 3bcc7f0a6f..deb78b2a47 100644
--- a/rust/datafusion/src/physical_plan/repartition.rs
+++ b/rust/datafusion/src/physical_plan/repartition.rs
@@ -243,7 +243,7 @@ mod tests {
use arrow::datatypes::{DataType, Field, Schema};
use arrow::record_batch::RecordBatch;
- #[tokio::test(threaded_scheduler)]
+ #[tokio::test(flavor = "multi_thread")]
async fn one_to_many_round_robin() -> Result<()> {
// define input partitions
let schema = test_schema();
@@ -263,7 +263,7 @@ mod tests {
Ok(())
}
- #[tokio::test(threaded_scheduler)]
+ #[tokio::test(flavor = "multi_thread")]
async fn many_to_one_round_robin() -> Result<()> {
// define input partitions
let schema = test_schema();
@@ -280,7 +280,7 @@ mod tests {
Ok(())
}
- #[tokio::test(threaded_scheduler)]
+ #[tokio::test(flavor = "multi_thread")]
async fn many_to_many_round_robin() -> Result<()> {
// define input partitions
let schema = test_schema();