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

Commit

Permalink
Reverted.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecarleitao committed Aug 19, 2021
1 parent a938782 commit beaf307
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
5 changes: 3 additions & 2 deletions src/array/growable/fixed_binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,12 @@ impl<'a> Growable<'a> for GrowableFixedSizeBinary<'a> {
let values = array.values();

self.values
.extend_from_slice(&values[start * self.size..(start + len) * self.size]);
.extend_from_slice(&values[start * self.size..start * self.size + len * self.size]);
}

fn extend_validity(&mut self, additional: usize) {
self.values.extend_constant(self.size * additional, 0);
self.values
.extend_from_slice(&vec![0; self.size * additional]);
self.validity.extend_constant(additional, false);
}

Expand Down
14 changes: 7 additions & 7 deletions src/scalar/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use super::Scalar;
/// [`Array`]. The only difference is that this has only one element.
#[derive(Debug, Clone)]
pub struct ListScalar<O: Offset> {
value: Arc<dyn Array>,
values: Arc<dyn Array>,
is_valid: bool,
phantom: std::marker::PhantomData<O>,
data_type: DataType,
Expand All @@ -19,7 +19,7 @@ impl<O: Offset> PartialEq for ListScalar<O> {
fn eq(&self, other: &Self) -> bool {
(self.data_type == other.data_type)
&& (self.is_valid == other.is_valid)
&& ((!self.is_valid) | (self.value.as_ref() == other.value.as_ref()))
&& ((!self.is_valid) | (self.values.as_ref() == other.values.as_ref()))
}
}

Expand All @@ -29,25 +29,25 @@ impl<O: Offset> ListScalar<O> {
/// * the `data_type` is not `List` or `LargeList` (depending on this scalar's offset `O`)
/// * the child of the `data_type` is not equal to the `values`
#[inline]
pub fn new(data_type: DataType, value: Option<Arc<dyn Array>>) -> Self {
pub fn new(data_type: DataType, values: Option<Arc<dyn Array>>) -> Self {
let inner_data_type = ListArray::<O>::get_child_type(&data_type);
let (is_valid, value) = match value {
let (is_valid, values) = match values {
Some(values) => {
assert_eq!(inner_data_type, values.data_type());
(true, values)
}
None => (false, new_empty_array(inner_data_type.clone()).into()),
};
Self {
value,
values,
is_valid,
phantom: std::marker::PhantomData,
data_type,
}
}

pub fn value(&self) -> &Arc<dyn Array> {
&self.value
pub fn values(&self) -> &Arc<dyn Array> {
&self.values
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/it/scalar/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn basics() {
Some(Arc::new(BooleanArray::from_slice([true, false])) as Arc<dyn Array>),
);

assert_eq!(BooleanArray::from_slice([true, false]), a.value().as_ref());
assert_eq!(BooleanArray::from_slice([true, false]), a.values().as_ref());
assert_eq!(a.data_type(), &dt);
assert!(a.is_valid());

Expand Down

0 comments on commit beaf307

Please sign in to comment.