Skip to content

Commit

Permalink
Remove unecessary Mutex in Ballista client
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed Mar 1, 2022
1 parent 9884594 commit bccd43d
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions ballista/rust/core/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

//! Client API for sending requests to executors.
use parking_lot::Mutex;
use std::sync::Arc;
use std::{collections::HashMap, pin::Pin};
use std::{
Expand Down Expand Up @@ -135,28 +134,24 @@ 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 }
}
}

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)))
Expand Down

0 comments on commit bccd43d

Please sign in to comment.