Skip to content

Commit 05fc936

Browse files
committed
ArrayRef
Signed-off-by: Nicholas Gates <nick@nickgates.com>
1 parent 80bd461 commit 05fc936

7 files changed

Lines changed: 16 additions & 26 deletions

File tree

vortex-array/src/accessor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub trait ArrayAccessor<Item: ?Sized> {
66
/// Iterate over each element of the array, in-order.
77
///
88
/// The function `f` will be passed an [`Iterator`], it can call [`Iterator::next`] on the
9-
/// iterator [`crate::DynArray::len`] times. Iterator elements are `Option` types,
9+
/// iterator `len` times. Iterator elements are `Option` types,
1010
/// regardless of the nullability of the underlying array data.
1111
fn with_iterator<F, R>(&self, f: F) -> R
1212
where

vortex-array/src/canonical.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ use crate::vtable::ArrayView;
5555

5656
/// An enum capturing the default uncompressed encodings for each [Vortex type](DType).
5757
///
58-
/// Any array can be decoded into canonical form via the [`to_canonical`](DynArray::to_canonical)
58+
/// Any array can be decoded into canonical form via the `to_canonical`
5959
/// trait method. This is the simplest encoding for a type, and will not be compressed but may
6060
/// contain compressed child arrays.
6161
///

vortex-array/src/serde.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ impl ArrayChildren for &[ArrayRef] {
281281
}
282282
}
283283

284-
/// [`ArrayParts`] represents a parsed but not-yet-decoded deserialized [`DynArray`].
284+
/// [`ArrayParts`] represents a parsed but not-yet-decoded deserialized array.
285285
/// It contains all the information from the serialized form, without anything extra. i.e.
286286
/// it is missing a [`DType`] and `len`, and the `encoding_id` is not yet resolved to a concrete
287287
/// vtable.

vortex-array/src/vtable/dyn_.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ pub type ArrayId = ArcRef<str>;
3131
pub type DynVTableRef = Arc<dyn DynVTable>;
3232

3333
/// Dynamically typed vtable trait.
34-
///
35-
/// This trait contains the implementation API for Vortex arrays, allowing us to keep the public
36-
/// [`DynArray`] trait API to a minimum.
3734
pub trait DynVTable: 'static + Send + Sync + Debug {
3835
/// Clone this vtable into a `Box<dyn DynVTable>`.
3936
fn clone_boxed(&self) -> Box<dyn DynVTable>;

vortex-array/src/vtable/typed.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ impl<V: VTable> AsRef<ArrayRef> for Array<V> {
369369
}
370370

371371
impl<V: VTable> IntoArray for Array<V> {
372+
#[inline(always)]
372373
fn into_array(self) -> ArrayRef {
373374
self.inner
374375
}

vortex-ffi/cinclude/vortex.h

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -499,18 +499,10 @@ typedef struct {
499499
extern "C" {
500500
#endif // __cplusplus
501501

502-
/**
503-
* Clone a borrowed [`vx_array`], returning an owned [`vx_array`].
504-
*
505-
*
506-
* Must be released with [`vx_array_free`].
507-
*/
508-
const vx_array *vx_array_clone(const vx_array *ptr);
509-
510502
/**
511503
* Free an owned [`vx_array`] object.
512504
*/
513-
void vx_array_free(const vx_array *ptr);
505+
void vx_array_free(vx_array *ptr);
514506

515507
/**
516508
* Check if array's dtype is nullable.
@@ -559,9 +551,9 @@ size_t vx_array_len(const vx_array *array);
559551
*/
560552
const vx_dtype *vx_array_dtype(const vx_array *array);
561553

562-
const vx_array *vx_array_get_field(const vx_array *array, size_t index, vx_error **error_out);
554+
vx_array *vx_array_get_field(const vx_array *array, size_t index, vx_error **error_out);
563555

564-
const vx_array *vx_array_slice(const vx_array *array, size_t start, size_t stop, vx_error **error_out);
556+
vx_array *vx_array_slice(const vx_array *array, size_t start, size_t stop, vx_error **error_out);
565557

566558
/**
567559
* Check whether array's element at index is invalid (null) according to the
@@ -578,7 +570,7 @@ size_t vx_array_invalid_count(const vx_array *array, vx_error **error_out);
578570
/**
579571
* Create a new array with DTYPE_NULL dtype.
580572
*/
581-
const vx_array *vx_array_new_null(size_t len);
573+
vx_array *vx_array_new_null(size_t len);
582574

583575
/**
584576
* Create a new primitive array from an existing buffer.
@@ -597,11 +589,11 @@ const vx_array *vx_array_new_null(size_t len);
597589
* vx_array_free(array);
598590
*
599591
*/
600-
const vx_array *vx_array_new_primitive(vx_ptype ptype,
601-
const void *ptr,
602-
size_t len,
603-
const vx_validity *validity,
604-
vx_error **error);
592+
vx_array *vx_array_new_primitive(vx_ptype ptype,
593+
const void *ptr,
594+
size_t len,
595+
const vx_validity *validity,
596+
vx_error **error);
605597

606598
uint8_t vx_array_get_u8(const vx_array *array, size_t index);
607599

@@ -664,7 +656,7 @@ const vx_binary *vx_array_get_binary(const vx_array *array, uint32_t index);
664656
* This operation takes constant time as it doesn't execute the underlying
665657
* array. Executing the underlying array still takes O(n) time.
666658
*/
667-
const vx_array *vx_array_apply(const vx_array *array, const vx_expression *expression, vx_error **error);
659+
vx_array *vx_array_apply(const vx_array *array, const vx_expression *expression, vx_error **error);
668660

669661
/**
670662
* Free an owned [`vx_array_iterator`] object.
@@ -679,7 +671,7 @@ void vx_array_iterator_free(vx_array_iterator *ptr);
679671
*
680672
* It is an error to call this function again after the iterator is finished.
681673
*/
682-
const vx_array *vx_array_iterator_next(vx_array_iterator *iter, vx_error **error_out);
674+
vx_array *vx_array_iterator_next(vx_array_iterator *iter, vx_error **error_out);
683675

684676
/**
685677
* Clone a borrowed [`vx_binary`], returning an owned [`vx_binary`].

wasm-test/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use vortex::compressor::BtrBlocksCompressor;
1010

1111
pub fn main() {
1212
// Extremely simple test of compression/decompression and a few compute functions.
13-
let array = PrimitiveArray::new(buffer![1i32; 1024], Validity::AllValid).to_array();
13+
let array = PrimitiveArray::new(buffer![1i32; 1024], Validity::AllValid).into_array();
1414

1515
let compressed = BtrBlocksCompressor::default().compress(&array).unwrap();
1616
println!("Compressed size: {}", compressed.len());

0 commit comments

Comments
 (0)