From 59417b36023bdf85305a86e62261811c7f1c632f Mon Sep 17 00:00:00 2001 From: Daniel King Date: Thu, 5 Sep 2024 11:21:23 -0400 Subject: [PATCH] use try_collect to avoid a double collect --- pyvortex/src/io.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pyvortex/src/io.rs b/pyvortex/src/io.rs index 0a1320722d..622303004c 100644 --- a/pyvortex/src/io.rs +++ b/pyvortex/src/io.rs @@ -1,6 +1,6 @@ use std::path::Path; -use futures::StreamExt; +use futures::TryStreamExt; use pyo3::exceptions::PyTypeError; use pyo3::prelude::*; use pyo3::pyfunction; @@ -156,11 +156,7 @@ pub fn read<'py>( let dtype = stream.schema().into_dtype(); - let vecs = stream - .collect::>>() - .await - .into_iter() // TODO(dk) unclear why I need two collects to pacify the compiler - .collect::>>()?; + let vecs: Vec = stream.try_collect().await?; if vecs.len() == 1 { Ok(vecs.into_iter().next().unwrap())