Skip to content

Apache DataFusion SQL Query Engine

Remove unecessary Mutex in Ballista client (#1898)

Andrew Lambe8aff599607b
diff --git a/ballista/rust/core/src/client.rs b/ballista/rust/core/src/client.rs
index ccbaea8da9..54418884d3 100644
--- a/ballista/rust/core/src/client.rs
+++ b/ballista/rust/core/src/client.rs
@@ -17,7 +17,6 @@
//! Client API for sending requests to executors.
-use parking_lot::Mutex;
use std::sync::Arc;
use std::{
@@ -130,16 +129,13 @@ impl BallistaClient {
}
struct FlightDataStream {
- stream: Mutex<Streaming<FlightData>>,
+ stream: Streaming<FlightData>,
schema: SchemaRef,
}
impl FlightDataStream {
pub fn new(stream: Streaming<FlightData>, schema: SchemaRef) -> Self {
- Self {
- stream: Mutex::new(stream),
- schema,
- }
+ Self { stream, schema }
}
}
@@ -147,11 +143,10 @@ impl Stream for FlightDataStream {
type Item = ArrowResult<RecordBatch>;
fn poll_next(
- self: std::pin::Pin<&mut Self>,
+ mut self: std::pin::Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Option<Self::Item>> {
- let mut stream = self.stream.lock();
- stream.poll_next_unpin(cx).map(|x| match x {
+ self.stream.poll_next_unpin(cx).map(|x| match x {
Some(flight_data_chunk_result) => {
let converted_chunk = flight_data_chunk_result
.map_err(|e| ArrowError::from_external_error(Box::new(e)))