Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sundy-li committed Aug 2, 2021
1 parent 9c7dac5 commit 8dbd277
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 4 deletions.
33 changes: 32 additions & 1 deletion common/datavalues/src/data_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ use common_exception::ErrorCode;
use common_exception::Result;
use common_io::prelude::*;

use crate::arrays::ListBooleanArrayBuilder;
use crate::arrays::ListBuilderTrait;
use crate::arrays::ListPrimitiveArrayBuilder;
use crate::arrays::ListUtf8ArrayBuilder;
use crate::data_type::*;
use crate::prelude::*;
use crate::series::IntoSeries;
Expand Down Expand Up @@ -183,7 +185,36 @@ impl DataValue {
DataType::Float32 => build_list_series! {Float32Type, values, size, data_type },
DataType::Float64 => build_list_series! {Float64Type, values, size, data_type },

// DataType::Utf8 => Ok(Arc::new(build_list!(StringBuilder, Utf8, values, size))),
DataType::Boolean => {
let mut builder = ListBooleanArrayBuilder::with_capacity(0, size);
match values {
Some(v) => {
let series = DataValue::try_into_data_array(v, data_type)?;
(0..size).for_each(|_| {
builder.append_series(&series);
});
}
None => (0..size).for_each(|_| {
builder.append_null();
}),
}
Ok(builder.finish().into_series())
}
DataType::Utf8 => {
let mut builder = ListUtf8ArrayBuilder::with_capacity(0, size);
match values {
Some(v) => {
let series = DataValue::try_into_data_array(v, data_type)?;
(0..size).for_each(|_| {
builder.append_series(&series);
});
}
None => (0..size).for_each(|_| {
builder.append_null();
}),
}
Ok(builder.finish().into_series())
}
other => Result::Err(ErrorCode::BadDataValueType(format!(
"Unexpected type:{} for DataValue List",
other
Expand Down
4 changes: 3 additions & 1 deletion common/datavalues/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ macro_rules! build_list_series {
}),
Some(v) => {
let series = DataValue::try_into_data_array(&v, $D_TYPE)?;
builder.append_series(&series);
(0..$SIZE).for_each(|_| {
builder.append_series(&series);
})
}
}
Ok(builder.finish().into_series())
Expand Down
7 changes: 5 additions & 2 deletions fusestore/store/src/executor/action_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0.

use std::fs::File;
use std::io::Cursor;
use std::pin::Pin;
use std::sync::Arc;

Expand Down Expand Up @@ -172,7 +172,10 @@ impl ActionHandler {
let schema = plan.schema;
let projection = (0..schema.fields().len()).collect::<Vec<_>>();

let reader = File::open(&part_file)?;
// TODO expose a reader from fs
let content = self.fs.read_all(&part_file).await?;
let reader = Cursor::new(content);

let reader = read::RecordReader::try_new(
reader,
Some(projection.to_vec()),
Expand Down

0 comments on commit 8dbd277

Please sign in to comment.