Skip to content

Commit 53d392c

Browse files
Dandandanjorgecarleitaoalambovrkou
committed
ARROW-11022: [Rust] Upgrade to Tokio 1.0
Upgrades crates to use latest versions of * tokio (1.0) * tonic (0.4) * prost (0.7) I ran the tests/benchmarks to make sure nothing is broken. Closes #9230 from Dandandan/tokio_1 Lead-authored-by: Heres, Daniel <danielheres@gmail.com> Co-authored-by: Jorge C. Leitao <jorgecarleitao@gmail.com> Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org> Co-authored-by: Dmitry Patsura <zaets28rus@gmail.com> Co-authored-by: Sutou Kouhei <kou@clear-code.com> Co-authored-by: Neville Dipale <nevilledips@gmail.com> Co-authored-by: Yibo Cai <yibo.cai@arm.com> Co-authored-by: Weston Pace <weston.pace@gmail.com> Co-authored-by: Maarten A. Breddels <maartenbreddels@gmail.com> Co-authored-by: mqy <meng.qingyou@gmail.com> Co-authored-by: Yordan Pavlov <yordan.pavlov@outlook.com> Co-authored-by: Johannes Müller <JohannesMueller@fico.com> Co-authored-by: Antoine Pitrou <antoine@python.org> Co-authored-by: Max Burke <max@urbanlogiq.com> Co-authored-by: Mahmut Bulut <vertexclique@gmail.com> Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com> Co-authored-by: Ryan Jennings <ryan@ryanj.net> Co-authored-by: Kenta Murata <mrkn@mrkn.jp> Co-authored-by: Krisztián Szűcs <szucs.krisztian@gmail.com> Co-authored-by: Matt Brubeck <mbrubeck@limpet.net> Co-authored-by: Daniël Heres <danielheres@gmail.com> Co-authored-by: Jörn Horstmann <joern.horstmann@signavio.com> Co-authored-by: Benjamin Kietzman <bengilgit@gmail.com> Signed-off-by: Neville Dipale <nevilledips@gmail.com>
1 parent cbea7ad commit 53d392c

14 files changed

Lines changed: 69 additions & 78 deletions

File tree

rust/arrow-flight/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ license = "Apache-2.0"
2727

2828
[dependencies]
2929
arrow = { path = "../arrow", version = "4.0.0-SNAPSHOT" }
30-
tonic = "0.3"
30+
tonic = "0.4"
3131
bytes = "1"
32-
prost = "0.6"
33-
prost-derive = "0.6"
34-
tokio = { version = "0.2", features = ["macros"] }
32+
prost = "0.7"
33+
prost-derive = "0.7"
34+
tokio = { version = "1.0", features = ["macros", "rt", "rt-multi-thread"] }
3535
futures = { version = "0.3", default-features = false, features = ["alloc"]}
3636

3737
[build-dependencies]
38-
tonic-build = "0.3"
38+
tonic-build = "0.4"
3939
# Pin specific version of the tonic-build dependencies to avoid auto-generated
4040
# (and checked in) arrow.flight.protocol.rs from changing
4141
proc-macro2 = "=1.0.24"

rust/arrow-flight/src/arrow.flight.protocol.rs

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ pub struct HandshakeRequest {
1010
pub protocol_version: u64,
1111
///
1212
/// Arbitrary auth/handshake info.
13-
#[prost(bytes, tag = "2")]
14-
pub payload: std::vec::Vec<u8>,
13+
#[prost(bytes = "vec", tag = "2")]
14+
pub payload: ::prost::alloc::vec::Vec<u8>,
1515
}
1616
#[derive(Clone, PartialEq, ::prost::Message)]
1717
pub struct HandshakeResponse {
@@ -21,17 +21,17 @@ pub struct HandshakeResponse {
2121
pub protocol_version: u64,
2222
///
2323
/// Arbitrary auth/handshake info.
24-
#[prost(bytes, tag = "2")]
25-
pub payload: std::vec::Vec<u8>,
24+
#[prost(bytes = "vec", tag = "2")]
25+
pub payload: ::prost::alloc::vec::Vec<u8>,
2626
}
2727
///
2828
/// A message for doing simple auth.
2929
#[derive(Clone, PartialEq, ::prost::Message)]
3030
pub struct BasicAuth {
3131
#[prost(string, tag = "2")]
32-
pub username: std::string::String,
32+
pub username: ::prost::alloc::string::String,
3333
#[prost(string, tag = "3")]
34-
pub password: std::string::String,
34+
pub password: ::prost::alloc::string::String,
3535
}
3636
#[derive(Clone, PartialEq, ::prost::Message)]
3737
pub struct Empty {}
@@ -41,41 +41,41 @@ pub struct Empty {}
4141
#[derive(Clone, PartialEq, ::prost::Message)]
4242
pub struct ActionType {
4343
#[prost(string, tag = "1")]
44-
pub r#type: std::string::String,
44+
pub r#type: ::prost::alloc::string::String,
4545
#[prost(string, tag = "2")]
46-
pub description: std::string::String,
46+
pub description: ::prost::alloc::string::String,
4747
}
4848
///
4949
/// A service specific expression that can be used to return a limited set
5050
/// of available Arrow Flight streams.
5151
#[derive(Clone, PartialEq, ::prost::Message)]
5252
pub struct Criteria {
53-
#[prost(bytes, tag = "1")]
54-
pub expression: std::vec::Vec<u8>,
53+
#[prost(bytes = "vec", tag = "1")]
54+
pub expression: ::prost::alloc::vec::Vec<u8>,
5555
}
5656
///
5757
/// An opaque action specific for the service.
5858
#[derive(Clone, PartialEq, ::prost::Message)]
5959
pub struct Action {
6060
#[prost(string, tag = "1")]
61-
pub r#type: std::string::String,
62-
#[prost(bytes, tag = "2")]
63-
pub body: std::vec::Vec<u8>,
61+
pub r#type: ::prost::alloc::string::String,
62+
#[prost(bytes = "vec", tag = "2")]
63+
pub body: ::prost::alloc::vec::Vec<u8>,
6464
}
6565
///
6666
/// An opaque result returned after executing an action.
6767
#[derive(Clone, PartialEq, ::prost::Message)]
6868
pub struct Result {
69-
#[prost(bytes, tag = "1")]
70-
pub body: std::vec::Vec<u8>,
69+
#[prost(bytes = "vec", tag = "1")]
70+
pub body: ::prost::alloc::vec::Vec<u8>,
7171
}
7272
///
7373
/// Wrap the result of a getSchema call
7474
#[derive(Clone, PartialEq, ::prost::Message)]
7575
pub struct SchemaResult {
7676
/// schema of the dataset as described in Schema.fbs::Schema.
77-
#[prost(bytes, tag = "1")]
78-
pub schema: std::vec::Vec<u8>,
77+
#[prost(bytes = "vec", tag = "1")]
78+
pub schema: ::prost::alloc::vec::Vec<u8>,
7979
}
8080
///
8181
/// The name or tag for a Flight. May be used as a way to retrieve or generate
@@ -87,14 +87,15 @@ pub struct FlightDescriptor {
8787
///
8888
/// Opaque value used to express a command. Should only be defined when
8989
/// type = CMD.
90-
#[prost(bytes, tag = "2")]
91-
pub cmd: std::vec::Vec<u8>,
90+
#[prost(bytes = "vec", tag = "2")]
91+
pub cmd: ::prost::alloc::vec::Vec<u8>,
9292
///
9393
/// List of strings identifying a particular dataset. Should only be defined
9494
/// when type = PATH.
9595
#[prost(string, repeated, tag = "3")]
96-
pub path: ::std::vec::Vec<std::string::String>,
96+
pub path: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
9797
}
98+
/// Nested message and enum types in `FlightDescriptor`.
9899
pub mod flight_descriptor {
99100
///
100101
/// Describes what type of descriptor is defined.
@@ -121,17 +122,17 @@ pub mod flight_descriptor {
121122
#[derive(Clone, PartialEq, ::prost::Message)]
122123
pub struct FlightInfo {
123124
/// schema of the dataset as described in Schema.fbs::Schema.
124-
#[prost(bytes, tag = "1")]
125-
pub schema: std::vec::Vec<u8>,
125+
#[prost(bytes = "vec", tag = "1")]
126+
pub schema: ::prost::alloc::vec::Vec<u8>,
126127
///
127128
/// The descriptor associated with this info.
128129
#[prost(message, optional, tag = "2")]
129-
pub flight_descriptor: ::std::option::Option<FlightDescriptor>,
130+
pub flight_descriptor: ::core::option::Option<FlightDescriptor>,
130131
///
131132
/// A list of endpoints associated with the flight. To consume the whole
132133
/// flight, all endpoints must be consumed.
133134
#[prost(message, repeated, tag = "3")]
134-
pub endpoint: ::std::vec::Vec<FlightEndpoint>,
135+
pub endpoint: ::prost::alloc::vec::Vec<FlightEndpoint>,
135136
/// Set these to -1 if unknown.
136137
#[prost(int64, tag = "4")]
137138
pub total_records: i64,
@@ -145,29 +146,29 @@ pub struct FlightEndpoint {
145146
///
146147
/// Token used to retrieve this stream.
147148
#[prost(message, optional, tag = "1")]
148-
pub ticket: ::std::option::Option<Ticket>,
149+
pub ticket: ::core::option::Option<Ticket>,
149150
///
150151
/// A list of URIs where this ticket can be redeemed. If the list is
151152
/// empty, the expectation is that the ticket can only be redeemed on the
152153
/// current service where the ticket was generated.
153154
#[prost(message, repeated, tag = "2")]
154-
pub location: ::std::vec::Vec<Location>,
155+
pub location: ::prost::alloc::vec::Vec<Location>,
155156
}
156157
///
157158
/// A location where a Flight service will accept retrieval of a particular
158159
/// stream given a ticket.
159160
#[derive(Clone, PartialEq, ::prost::Message)]
160161
pub struct Location {
161162
#[prost(string, tag = "1")]
162-
pub uri: std::string::String,
163+
pub uri: ::prost::alloc::string::String,
163164
}
164165
///
165166
/// An opaque identifier that the service can use to retrieve a particular
166167
/// portion of a stream.
167168
#[derive(Clone, PartialEq, ::prost::Message)]
168169
pub struct Ticket {
169-
#[prost(bytes, tag = "1")]
170-
pub ticket: std::vec::Vec<u8>,
170+
#[prost(bytes = "vec", tag = "1")]
171+
pub ticket: ::prost::alloc::vec::Vec<u8>,
171172
}
172173
///
173174
/// A batch of Arrow data as part of a stream of batches.
@@ -177,29 +178,29 @@ pub struct FlightData {
177178
/// The descriptor of the data. This is only relevant when a client is
178179
/// starting a new DoPut stream.
179180
#[prost(message, optional, tag = "1")]
180-
pub flight_descriptor: ::std::option::Option<FlightDescriptor>,
181+
pub flight_descriptor: ::core::option::Option<FlightDescriptor>,
181182
///
182183
/// Header for message data as described in Message.fbs::Message.
183-
#[prost(bytes, tag = "2")]
184-
pub data_header: std::vec::Vec<u8>,
184+
#[prost(bytes = "vec", tag = "2")]
185+
pub data_header: ::prost::alloc::vec::Vec<u8>,
185186
///
186187
/// Application-defined metadata.
187-
#[prost(bytes, tag = "3")]
188-
pub app_metadata: std::vec::Vec<u8>,
188+
#[prost(bytes = "vec", tag = "3")]
189+
pub app_metadata: ::prost::alloc::vec::Vec<u8>,
189190
///
190191
/// The actual batch of Arrow data. Preferably handled with minimal-copies
191192
/// coming last in the definition to help with sidecar patterns (it is
192193
/// expected that some implementations will fetch this field off the wire
193194
/// with specialized code to avoid extra memory copies).
194-
#[prost(bytes, tag = "1000")]
195-
pub data_body: std::vec::Vec<u8>,
195+
#[prost(bytes = "vec", tag = "1000")]
196+
pub data_body: ::prost::alloc::vec::Vec<u8>,
196197
}
197198
///*
198199
/// The response message associated with the submission of a DoPut.
199200
#[derive(Clone, PartialEq, ::prost::Message)]
200201
pub struct PutResult {
201-
#[prost(bytes, tag = "1")]
202-
pub app_metadata: std::vec::Vec<u8>,
202+
#[prost(bytes = "vec", tag = "1")]
203+
pub app_metadata: ::prost::alloc::vec::Vec<u8>,
203204
}
204205
#[doc = r" Generated client implementations."]
205206
pub mod flight_service_client {
@@ -1010,6 +1011,7 @@ pub mod flight_service_server {
10101011
Ok(http::Response::builder()
10111012
.status(200)
10121013
.header("grpc-status", "12")
1014+
.header("content-type", "application/grpc")
10131015
.body(tonic::body::BoxBody::empty())
10141016
.unwrap())
10151017
}),

rust/benchmarks/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ arrow = { path = "../arrow" }
3535
parquet = { path = "../parquet" }
3636
datafusion = { path = "../datafusion" }
3737
structopt = { version = "0.3", default-features = false }
38-
tokio = { version = "0.2", features = ["macros", "rt-core", "rt-threaded"] }
38+
tokio = { version = "^1.0", features = ["macros", "rt", "rt-multi-thread"] }
3939
futures = "0.3"
4040
env_logger = "^0.8"
4141
snmalloc-rs = {version = "0.2", optional = true, features= ["cache-friendly"] }

rust/datafusion/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ chrono = "0.4"
5959
async-trait = "0.1.41"
6060
futures = "0.3"
6161
pin-project-lite= "^0.2.0"
62-
tokio = { version = "0.2", features = ["macros", "blocking", "rt-core", "rt-threaded", "sync"] }
62+
tokio = { version = "1.0", features = ["macros", "rt", "rt-multi-thread", "sync"] }
6363
log = "^0.4"
6464
md-5 = "^0.9.1"
6565
sha2 = "^0.9.1"
@@ -69,9 +69,9 @@ ordered-float = "2.0"
6969
rand = "0.8"
7070
criterion = "0.3"
7171
tempfile = "3"
72-
prost = "0.6"
72+
prost = "0.7"
7373
arrow-flight = { path = "../arrow-flight", version = "4.0.0-SNAPSHOT" }
74-
tonic = "0.3"
74+
tonic = "0.4"
7575

7676
[[bench]]
7777
name = "aggregate_query_sql"

rust/datafusion/benches/aggregate_query_sql.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub fn seedable_rng() -> StdRng {
4444
}
4545

4646
fn query(ctx: Arc<Mutex<ExecutionContext>>, sql: &str) {
47-
let mut rt = Runtime::new().unwrap();
47+
let rt = Runtime::new().unwrap();
4848

4949
// execute the query
5050
let df = ctx.lock().unwrap().sql(&sql).unwrap();

rust/datafusion/benches/math_query_sql.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ use datafusion::datasource::MemTable;
3737
use datafusion::execution::context::ExecutionContext;
3838

3939
fn query(ctx: Arc<Mutex<ExecutionContext>>, sql: &str) {
40-
let mut rt = Runtime::new().unwrap();
40+
let rt = Runtime::new().unwrap();
4141

4242
// execute the query
4343
let df = ctx.lock().unwrap().sql(&sql).unwrap();

rust/datafusion/benches/sort_limit_query_sql.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use datafusion::execution::context::ExecutionContext;
3232
use tokio::runtime::Runtime;
3333

3434
fn query(ctx: Arc<Mutex<ExecutionContext>>, sql: &str) {
35-
let mut rt = Runtime::new().unwrap();
35+
let rt = Runtime::new().unwrap();
3636

3737
// execute the query
3838
let df = ctx.lock().unwrap().sql(&sql).unwrap();
@@ -66,7 +66,7 @@ fn create_context() -> Arc<Mutex<ExecutionContext>> {
6666
)
6767
.unwrap();
6868

69-
let mut rt = Runtime::new().unwrap();
69+
let rt = Runtime::new().unwrap();
7070

7171
let ctx_holder: Arc<Mutex<Vec<Arc<Mutex<ExecutionContext>>>>> =
7272
Arc::new(Mutex::new(vec![]));

rust/datafusion/src/physical_plan/coalesce_batches.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ mod tests {
235235
use arrow::array::UInt32Array;
236236
use arrow::datatypes::{DataType, Field, Schema};
237237

238-
#[tokio::test(threaded_scheduler)]
238+
#[tokio::test(flavor = "multi_thread")]
239239
async fn test_concat_batches() -> Result<()> {
240240
let schema = test_schema();
241241
let partition = create_vec_batches(&schema, 10)?;

rust/datafusion/src/physical_plan/repartition.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ mod tests {
243243
use arrow::datatypes::{DataType, Field, Schema};
244244
use arrow::record_batch::RecordBatch;
245245

246-
#[tokio::test(threaded_scheduler)]
246+
#[tokio::test(flavor = "multi_thread")]
247247
async fn one_to_many_round_robin() -> Result<()> {
248248
// define input partitions
249249
let schema = test_schema();
@@ -263,7 +263,7 @@ mod tests {
263263
Ok(())
264264
}
265265

266-
#[tokio::test(threaded_scheduler)]
266+
#[tokio::test(flavor = "multi_thread")]
267267
async fn many_to_one_round_robin() -> Result<()> {
268268
// define input partitions
269269
let schema = test_schema();
@@ -280,7 +280,7 @@ mod tests {
280280
Ok(())
281281
}
282282

283-
#[tokio::test(threaded_scheduler)]
283+
#[tokio::test(flavor = "multi_thread")]
284284
async fn many_to_many_round_robin() -> Result<()> {
285285
// define input partitions
286286
let schema = test_schema();

rust/integration-testing/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ async-trait = "0.1.41"
3636
clap = "2.33"
3737
futures = "0.3"
3838
hex = "0.4"
39-
prost = "0.6"
39+
prost = "0.7"
4040
serde = { version = "1.0", features = ["rc"] }
4141
serde_derive = "1.0"
4242
serde_json = { version = "1.0", features = ["preserve_order"] }
43-
tokio = { version = "0.2", features = ["macros", "rt-core", "rt-threaded"] }
44-
tonic = "0.3"
43+
tokio = { version = "1.0", features = ["macros", "rt", "rt-multi-thread"] }
44+
tonic = "0.4"
4545
tracing-subscriber = { version = "0.2.15", optional = true }

0 commit comments

Comments
 (0)