Skip to content

Commit 4b01772

Browse files
committed
Refactor to introduce type aliases for cached batches in dataframe.rs
1 parent fd504a1 commit 4b01772

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/dataframe.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ use crate::{
6060

6161
use parking_lot::Mutex;
6262

63+
// Type aliases to simplify very complex types used in this file and
64+
// avoid compiler complaints about deeply nested types in struct fields.
65+
type CachedBatches = Option<(Vec<RecordBatch>, bool)>;
66+
type SharedCachedBatches = Arc<Mutex<CachedBatches>>;
67+
6368
// https://github.com/apache/datafusion-python/pull/1016#discussion_r1983239116
6469
// - we have not decided on the table_provider approach yet
6570
// this is an interim implementation
@@ -292,7 +297,7 @@ pub struct PyDataFrame {
292297
df: Arc<DataFrame>,
293298

294299
// In IPython environment cache batches between __repr__ and _repr_html_ calls.
295-
batches: Arc<Mutex<Option<(Vec<RecordBatch>, bool)>>>,
300+
batches: SharedCachedBatches,
296301
}
297302

298303
impl PyDataFrame {

0 commit comments

Comments
 (0)