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

fix: return Vec<Datafile> instead of HashMap #126

Merged
merged 1 commit into from
Jul 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
}