Skip to content
This repository has been archived by the owner on Aug 13, 2024. It is now read-only.

Commit

Permalink
fix: return Vec<Datafile> instead of HashMap in TaskWriter (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZENOTME authored Jul 31, 2023
1 parent 34bc8a3 commit b185d86
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions icelake/src/io/task_writer.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
//! task_writer module provide a task writer for writing data in a table.
//! table writer used directly by the compute engine.

use std::collections::HashMap;

use arrow_array::RecordBatch;
use arrow_schema::Schema as ArrowSchema;
use opendal::Operator;
Expand All @@ -11,7 +9,7 @@ use super::data_file_writer::DataFileWriter;
use super::location_generator;
use crate::error::Result;
use crate::io::location_generator::DataFileLocationGenerator;
use crate::types::{DataFile, StructValue, TableMetadata};
use crate::types::{DataFile, TableMetadata};

/// `TaskWriter` used to write data for a table.
///
Expand Down Expand Up @@ -91,7 +89,7 @@ impl TaskWriter {
}

/// Close the writer and return the data files.
pub async fn close(self) -> Result<HashMap<StructValue, Vec<DataFile>>> {
pub async fn close(self) -> Result<Vec<DataFile>> {
match self {
Self::Unpartitioned(writer) => writer.close().await,
}
Expand Down Expand Up @@ -137,10 +135,7 @@ impl UnpartitionedWriter {
/// # Note
///
/// For unpartitioned table, the key of the result map is default partition key.
pub async fn close(self) -> Result<HashMap<StructValue, Vec<DataFile>>> {
let datafiles = self.data_file_writer.close().await?;
let mut result = HashMap::new();
result.insert(StructValue::default(), datafiles);
Ok(result)
pub async fn close(self) -> Result<Vec<DataFile>> {
self.data_file_writer.close().await
}
}

0 comments on commit b185d86

Please sign in to comment.