Skip to content
Closed
Show file tree
Hide file tree
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
3,828 changes: 6 additions & 3,822 deletions rust/arrow/src/array/array.rs

Large diffs are not rendered by default.

797 changes: 797 additions & 0 deletions rust/arrow/src/array/array_binary.rs

Large diffs are not rendered by default.

412 changes: 412 additions & 0 deletions rust/arrow/src/array/array_dictionary.rs

Large diffs are not rendered by default.

815 changes: 815 additions & 0 deletions rust/arrow/src/array/array_list.rs

Large diffs are not rendered by default.

989 changes: 989 additions & 0 deletions rust/arrow/src/array/array_primitive.rs

Large diffs are not rendered by default.

445 changes: 445 additions & 0 deletions rust/arrow/src/array/array_string.rs

Large diffs are not rendered by default.

535 changes: 535 additions & 0 deletions rust/arrow/src/array/array_struct.rs

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions rust/arrow/src/array/equal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
//! depend on dynamic casting of `Array`.

use super::{
array::BinaryOffsetSizeTrait, Array, ArrayData, FixedSizeBinaryArray,
GenericBinaryArray, GenericListArray, GenericStringArray, OffsetSizeTrait,
PrimitiveArray, StringOffsetSizeTrait, StructArray,
Array, ArrayData, BinaryOffsetSizeTrait, FixedSizeBinaryArray, GenericBinaryArray,
GenericListArray, GenericStringArray, OffsetSizeTrait, PrimitiveArray,
StringOffsetSizeTrait, StructArray,
};

use crate::datatypes::{ArrowPrimitiveType, DataType, IntervalUnit};
Expand Down Expand Up @@ -216,7 +216,7 @@ mod tests {
use std::sync::Arc;

use crate::array::{
array::Array, array::BinaryOffsetSizeTrait, ArrayDataRef, ArrayRef, BooleanArray,
array::Array, ArrayDataRef, ArrayRef, BinaryOffsetSizeTrait, BooleanArray,
FixedSizeBinaryBuilder, FixedSizeListBuilder, GenericBinaryArray, Int32Builder,
ListBuilder, NullArray, PrimitiveBuilder, StringArray, StringDictionaryBuilder,
StringOffsetSizeTrait, StructArray,
Expand Down
5 changes: 1 addition & 4 deletions rust/arrow/src/array/equal_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@

use super::*;
use crate::datatypes::*;
use array::{
Array, BinaryOffsetSizeTrait, GenericBinaryArray, GenericListArray,
GenericStringArray, OffsetSizeTrait, StringOffsetSizeTrait,
};
use array::Array;
use hex::FromHex;
use serde_json::value::Value::{Null as JNull, Object, String as JString};
use serde_json::Value;
Expand Down
4 changes: 2 additions & 2 deletions rust/arrow/src/array/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
use crate::datatypes::ArrowPrimitiveType;

use super::{
array::BinaryOffsetSizeTrait, Array, GenericBinaryArray, GenericStringArray,
PrimitiveArray, StringOffsetSizeTrait,
Array, BinaryOffsetSizeTrait, GenericBinaryArray, GenericStringArray, PrimitiveArray,
StringOffsetSizeTrait,
};

/// an iterator that returns Some(T) or None, that can be used on any non-boolean PrimitiveArray
Expand Down
40 changes: 24 additions & 16 deletions rust/arrow/src/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@

#[allow(clippy::module_inception)]
mod array;
mod array_binary;
mod array_dictionary;
mod array_list;
mod array_primitive;
mod array_string;
mod array_struct;
mod builder;
mod cast;
mod data;
Expand All @@ -91,6 +97,7 @@ mod equal_json;
mod iterator;
mod null;
mod ord;
mod raw_pointer;
mod union;

use crate::datatypes::*;
Expand All @@ -103,17 +110,17 @@ pub use self::data::ArrayData;
pub use self::data::ArrayDataBuilder;
pub use self::data::ArrayDataRef;

pub use self::array::BinaryArray;
pub use self::array::DictionaryArray;
pub use self::array::FixedSizeBinaryArray;
pub use self::array::FixedSizeListArray;
pub use self::array::LargeBinaryArray;
pub use self::array::LargeListArray;
pub use self::array::LargeStringArray;
pub use self::array::ListArray;
pub use self::array::PrimitiveArray;
pub use self::array::StringArray;
pub use self::array::StructArray;
pub use self::array_binary::BinaryArray;
pub use self::array_binary::FixedSizeBinaryArray;
pub use self::array_binary::LargeBinaryArray;
pub use self::array_dictionary::DictionaryArray;
pub use self::array_list::FixedSizeListArray;
pub use self::array_list::LargeListArray;
pub use self::array_list::ListArray;
pub use self::array_primitive::PrimitiveArray;
pub use self::array_string::LargeStringArray;
pub use self::array_string::StringArray;
pub use self::array_struct::StructArray;
pub use self::null::NullArray;
pub use self::union::UnionArray;

Expand Down Expand Up @@ -157,11 +164,12 @@ pub type DurationMillisecondArray = PrimitiveArray<DurationMillisecondType>;
pub type DurationMicrosecondArray = PrimitiveArray<DurationMicrosecondType>;
pub type DurationNanosecondArray = PrimitiveArray<DurationNanosecondType>;

pub use self::array::GenericBinaryArray;
pub use self::array::GenericListArray;
pub use self::array::GenericStringArray;
pub use self::array::OffsetSizeTrait;
pub use self::array::StringOffsetSizeTrait;
pub use self::array_binary::BinaryOffsetSizeTrait;
pub use self::array_binary::GenericBinaryArray;
pub use self::array_list::GenericListArray;
pub use self::array_list::OffsetSizeTrait;
pub use self::array_string::GenericStringArray;
pub use self::array_string::StringOffsetSizeTrait;

// --------------------- Array Builder ---------------------

Expand Down
43 changes: 43 additions & 0 deletions rust/arrow/src/array/raw_pointer.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

use crate::memory;

pub(super) struct RawPtrBox<T> {
inner: *const T,
}

impl<T> RawPtrBox<T> {
pub(super) fn new(inner: *const T) -> Self {
Self { inner }
}

pub(super) fn get(&self) -> *const T {
self.inner
}
}

unsafe impl<T> Send for RawPtrBox<T> {}
unsafe impl<T> Sync for RawPtrBox<T> {}

pub(super) fn as_aligned_pointer<T>(p: *const u8) -> *const T {
assert!(
memory::is_aligned(p, std::mem::align_of::<T>()),
"memory is not aligned"
);
p as *const T
}
6 changes: 6 additions & 0 deletions rust/arrow/src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,12 @@ impl MutableBuffer {
}
}

/// creates a new [MutableBuffer] where every bit is initialized to `0`
pub fn new_null(len: usize) -> Self {
let num_bytes = bit_util::ceil(len, 8);
MutableBuffer::new(num_bytes).with_bitset(num_bytes, false)
}

/// Set the bits in the range of `[0, end)` to 0 (if `val` is false), or 1 (if `val`
/// is true). Also extend the length of this buffer to be `end`.
///
Expand Down