Skip to content

Commit 028e8de

Browse files
authored
Shutdown Tokio file (#4621)
Signed-off-by: Nicholas Gates <nick@nickgates.com>
1 parent 13f006f commit 028e8de

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

vortex-cxx/src/write.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use vortex::dtype::DType;
1313
use vortex::dtype::arrow::FromArrowType;
1414
use vortex::error::{VortexError, VortexExpect};
1515
use vortex::file::VortexWriteOptions as WriteOptions;
16+
use vortex::io::VortexWrite;
1617
use vortex::io::runtime::tokio::TokioRuntime;
1718
use vortex::iter::{ArrayIteratorAdapter, ArrayIteratorExt};
1819
use vortex::stream::ArrayStream;
@@ -67,6 +68,7 @@ pub(crate) unsafe fn write_array_stream(
6768
RUNTIME.block_on(async {
6869
let mut file = tokio::fs::File::create(path).await?;
6970
options.inner.write(&mut file, vortex_stream).await?;
71+
file.shutdown().await?;
7072
Ok(())
7173
})
7274
}

vortex-tui/src/convert.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use futures::StreamExt;
88
use indicatif::ProgressBar;
99
use parquet::arrow::ParquetRecordBatchStreamBuilder;
1010
use tokio::fs::File;
11+
use tokio::io::AsyncWriteExt;
1112
use vortex::ArrayRef;
1213
use vortex::arrow::FromArrowArray;
1314
use vortex::compressor::CompactCompressor;
@@ -80,13 +81,12 @@ pub async fn exec_convert(flags: Flags) -> anyhow::Result<()> {
8081
Strategy::Compact => strategy.with_compressor(CompactCompressor::default()),
8182
};
8283

84+
let mut file = File::create(output_path).await?;
8385
VortexWriteOptions::default()
8486
.with_strategy(strategy.build())
85-
.write(
86-
&mut File::create(output_path).await?,
87-
ArrayStreamAdapter::new(dtype, vortex_stream),
88-
)
87+
.write(&mut file, ArrayStreamAdapter::new(dtype, vortex_stream))
8988
.await?;
89+
file.shutdown().await?;
9090

9191
Ok(())
9292
}

0 commit comments

Comments
 (0)