Skip to content

Commit 7cc56ab

Browse files
authored
feat: update rust edition to 2024 (#1355)
* feat: update rust edition to 2024 * fix: correct msrvcheck * migrate resolver to v3 (2024 edition default)
1 parent 118327c commit 7cc56ab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+440
-376
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
[workspace]
1919
exclude = ["dev/msrvcheck", "python"]
2020
members = ["ballista-cli", "ballista/client", "ballista/core", "ballista/executor", "ballista/scheduler", "benchmarks", "examples"]
21-
resolver = "2"
21+
resolver = "3"
2222

2323
[workspace.package]
2424
# edition to be changed to 2024 when we update
2525
# Minimum Supported Rust Version (MSRV) to 1.85.0
2626
# which is datafusion 49
2727
#
28-
edition = "2021"
28+
edition = "2024"
2929
# we should try to follow datafusion version
3030
rust-version = "1.88.0"
3131

ballista-cli/src/command.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use datafusion::common::Result;
2828
use datafusion::error::DataFusionError;
2929
use datafusion::prelude::SessionContext;
3030

31-
use crate::functions::{display_all_functions, Function};
31+
use crate::functions::{Function, display_all_functions};
3232
use crate::print_format::PrintFormat;
3333
use crate::print_options::PrintOptions;
3434

ballista-cli/src/exec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
//! Execution functions
1919
2020
use std::fs::File;
21-
use std::io::prelude::*;
2221
use std::io::BufReader;
22+
use std::io::prelude::*;
2323
use std::sync::Arc;
2424
use std::time::Instant;
2525

2626
use datafusion::common::Result;
2727
use datafusion::prelude::SessionContext;
28-
use rustyline::error::ReadlineError;
2928
use rustyline::Editor;
29+
use rustyline::error::ReadlineError;
3030

3131
use crate::{
3232
command::{Command, OutputFormat},

ballista-cli/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use std::{env, sync::Arc};
2020

2121
use ballista::{extension::SessionConfigExt, prelude::SessionContextExt};
2222
use ballista_cli::{
23-
exec, print_format::PrintFormat, print_options::PrintOptions, BALLISTA_CLI_VERSION,
23+
BALLISTA_CLI_VERSION, exec, print_format::PrintFormat, print_options::PrintOptions,
2424
};
2525
use clap::Parser;
2626
use datafusion::{

ballista/client/tests/bugs.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,14 @@ order by sum_sales - avg_monthly_sales, s_store_name
130130

131131
let result = ctx.sql(query).await?.collect().await?;
132132
let expected = [
133-
"+-------------+-----------+----------------+----------------+--------+-------+--------------------+-----------+---------+---------+",
134-
"| i_category | i_brand | s_store_name | s_company_name | d_year | d_moy | avg_monthly_sales | sum_sales | psum | nsum |",
135-
"+-------------+-----------+----------------+----------------+--------+-------+--------------------+-----------+---------+---------+",
136-
"| Electronics | TechBrand | Downtown Store | Retail Corp | 1999 | 4 | 1499.9850000000001 | 999.99 | 999.99 | 999.99 |",
137-
"| Electronics | TechBrand | Downtown Store | Retail Corp | 1999 | 3 | 1499.9850000000001 | 999.99 | 1999.98 | 999.99 |",
138-
"| Electronics | TechBrand | Downtown Store | Retail Corp | 1999 | 1 | 1499.9850000000001 | 1999.98 | 1999.98 | 1999.98 |",
139-
"| Electronics | TechBrand | Downtown Store | Retail Corp | 1999 | 2 | 1499.9850000000001 | 1999.98 | 1999.98 | 999.99 |",
140-
"+-------------+-----------+----------------+----------------+--------+-------+--------------------+-----------+---------+---------+",
133+
"+-------------+-----------+----------------+----------------+--------+-------+--------------------+-----------+---------+---------+",
134+
"| i_category | i_brand | s_store_name | s_company_name | d_year | d_moy | avg_monthly_sales | sum_sales | psum | nsum |",
135+
"+-------------+-----------+----------------+----------------+--------+-------+--------------------+-----------+---------+---------+",
136+
"| Electronics | TechBrand | Downtown Store | Retail Corp | 1999 | 4 | 1499.9850000000001 | 999.99 | 999.99 | 999.99 |",
137+
"| Electronics | TechBrand | Downtown Store | Retail Corp | 1999 | 3 | 1499.9850000000001 | 999.99 | 1999.98 | 999.99 |",
138+
"| Electronics | TechBrand | Downtown Store | Retail Corp | 1999 | 1 | 1499.9850000000001 | 1999.98 | 1999.98 | 1999.98 |",
139+
"| Electronics | TechBrand | Downtown Store | Retail Corp | 1999 | 2 | 1499.9850000000001 | 1999.98 | 1999.98 | 999.99 |",
140+
"+-------------+-----------+----------------+----------------+--------+-------+--------------------+-----------+---------+---------+",
141141
];
142142

143143
assert_batches_eq!(expected, &result);

ballista/client/tests/common/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use std::path::PathBuf;
2121

2222
use ballista::prelude::{SessionConfigExt, SessionContextExt};
2323
use ballista_core::serde::{
24-
protobuf::scheduler_grpc_client::SchedulerGrpcClient, BallistaCodec,
24+
BallistaCodec, protobuf::scheduler_grpc_client::SchedulerGrpcClient,
2525
};
2626
use ballista_core::{ConfigProducer, RuntimeProducer};
2727
use ballista_scheduler::SessionBuilder;

ballista/client/tests/context_setup.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,15 @@ mod remote {
103103
#[cfg(feature = "standalone")]
104104
mod standalone {
105105

106-
use std::sync::{atomic::AtomicBool, Arc};
106+
use std::sync::{Arc, atomic::AtomicBool};
107107

108108
use ballista::extension::{SessionConfigExt, SessionContextExt};
109109
use ballista_core::serde::BallistaPhysicalExtensionCodec;
110110
use datafusion::{
111111
assert_batches_eq,
112112
common::exec_err,
113113
execution::{
114-
context::QueryPlanner, SessionState, SessionStateBuilder, TaskContext,
114+
SessionState, SessionStateBuilder, TaskContext, context::QueryPlanner,
115115
},
116116
logical_expr::LogicalPlan,
117117
physical_plan::ExecutionPlan,
@@ -226,9 +226,11 @@ mod standalone {
226226
.collect()
227227
.await;
228228

229-
assert!(physical_codec
230-
.invoked
231-
.load(std::sync::atomic::Ordering::Relaxed));
229+
assert!(
230+
physical_codec
231+
.invoked
232+
.load(std::sync::atomic::Ordering::Relaxed)
233+
);
232234
Ok(())
233235
}
234236

ballista/core/src/client.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ use crate::error::{BallistaError, Result as BResult};
2929
use crate::serde::scheduler::{Action, PartitionId};
3030

3131
use arrow_flight;
32-
use arrow_flight::utils::flight_data_to_arrow_batch;
3332
use arrow_flight::Ticket;
34-
use arrow_flight::{flight_service_client::FlightServiceClient, FlightData};
33+
use arrow_flight::utils::flight_data_to_arrow_batch;
34+
use arrow_flight::{FlightData, flight_service_client::FlightServiceClient};
3535
use datafusion::arrow::array::ArrayRef;
3636
use datafusion::arrow::buffer::{Buffer, MutableBuffer};
3737
use datafusion::arrow::ipc::convert::try_schema_from_ipc_buffer;
@@ -45,7 +45,7 @@ use datafusion::error::DataFusionError;
4545
use datafusion::error::Result;
4646

4747
use crate::serde::protobuf;
48-
use crate::utils::{create_grpc_client_connection, GrpcClientConfig};
48+
use crate::utils::{GrpcClientConfig, create_grpc_client_connection};
4949
use datafusion::physical_plan::{RecordBatchStream, SendableRecordBatchStream};
5050
use futures::{Stream, StreamExt};
5151
use log::{debug, warn};

ballista/core/src/consistent_hash/mod.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,10 @@ where
153153
.range(hashed_key..)
154154
.chain(self.virtual_nodes.iter())
155155
{
156-
if let Some((node, _)) = self.node_replicas.get(node_name) {
157-
if node.is_valid() {
158-
return Some(position_key.clone());
159-
}
156+
if let Some((node, _)) = self.node_replicas.get(node_name)
157+
&& node.is_valid()
158+
{
159+
return Some(position_key.clone());
160160
}
161161
if tolerance == 0 {
162162
return None;
@@ -177,8 +177,8 @@ pub fn md5_hash(data: &[u8]) -> Vec<u8> {
177177

178178
#[cfg(test)]
179179
mod test {
180-
use crate::consistent_hash::node::Node;
181180
use crate::consistent_hash::ConsistentHash;
181+
use crate::consistent_hash::node::Node;
182182

183183
#[test]
184184
fn test_topology() {
@@ -219,9 +219,11 @@ mod test {
219219
for (i, key) in keys.iter().enumerate() {
220220
if i == 2 {
221221
assert!(consistent_hash.get(key.as_bytes()).is_none());
222-
assert!(consistent_hash
223-
.get_with_tolerance(key.as_bytes(), 1)
224-
.is_some());
222+
assert!(
223+
consistent_hash
224+
.get_with_tolerance(key.as_bytes(), 1)
225+
.is_some()
226+
);
225227
} else {
226228
assert_eq!(
227229
consistent_hash.get(key.as_bytes()).unwrap().name(),

ballista/core/src/diagram.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ use crate::error::Result;
1919
use crate::execution_plans::{ShuffleWriterExec, UnresolvedShuffleExec};
2020

2121
use datafusion::datasource::source::DataSourceExec;
22+
use datafusion::physical_plan::ExecutionPlan;
2223
use datafusion::physical_plan::aggregates::AggregateExec;
2324
use datafusion::physical_plan::coalesce_batches::CoalesceBatchesExec;
2425
use datafusion::physical_plan::coalesce_partitions::CoalescePartitionsExec;
2526
use datafusion::physical_plan::filter::FilterExec;
2627
use datafusion::physical_plan::joins::HashJoinExec;
2728
use datafusion::physical_plan::projection::ProjectionExec;
2829
use datafusion::physical_plan::sorts::sort::SortExec;
29-
use datafusion::physical_plan::ExecutionPlan;
3030
use log::warn;
3131
use std::fs::File;
3232
use std::io::{BufWriter, Write};
33-
use std::sync::atomic::{AtomicUsize, Ordering};
3433
use std::sync::Arc;
34+
use std::sync::atomic::{AtomicUsize, Ordering};
3535

3636
pub fn produce_diagram(filename: &str, stages: &[Arc<ShuffleWriterExec>]) -> Result<()> {
3737
let write_file = File::create(filename)?;

0 commit comments

Comments
 (0)