Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array2: Struct Array #217

Merged
merged 15 commits into from
Apr 8, 2024
Merged
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
8 changes: 8 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ pyo3-log = "0.9.0"
rand = "0.8.5"
reqwest = { version = "0.12.0", features = ["blocking"] }
seq-macro = "0.3.5"
serde = "1.0.197"
simplelog = { version = "0.12.2", features = ["paris"] }
thiserror = "1.0.58"
uninit = "0.6.2"
Expand Down
46 changes: 0 additions & 46 deletions bench-vortex/src/bin/ipc.rs

This file was deleted.

1 change: 1 addition & 0 deletions vortex-array/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ vortex-alloc = { path = "../vortex-alloc" }
vortex-error = { path = "../vortex-error" }
vortex-flatbuffers = { path = "../vortex-flatbuffers" }
vortex-schema = { path = "../vortex-schema" }
serde = { workspace = true, features = ["derive"], optional = true }

[build-dependencies]
flatc = { workspace = true }
Expand Down
7 changes: 6 additions & 1 deletion vortex-array/flatbuffers/array.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ enum Version: uint8 {
V0 = 0,
}

// TODO(ngates): figure out if flatbuffers supports optional elements in a vector.
table ArrayChild {
child: Array;
}

table Array {
version: Version = V0;
encoding: uint16;
metadata: [ubyte];
children: [Array];
children: [ArrayChild];
nbuffers: uint16;
}

Expand Down
1 change: 1 addition & 0 deletions vortex-array/src/ptype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use vortex_schema::{DType, FloatWidth, IntWidth};

use crate::scalar::{PScalar, Scalar};

#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Eq, Hash)]
pub enum PType {
U8,
Expand Down
14 changes: 11 additions & 3 deletions vortex-array/src/serde/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,12 @@ impl<'a> ArrayView<'a> {
.children()?
.iter()
.take(idx)
.map(|child| Self::cumulative_nbuffers(child))
.map(|child| {
child
.child()
.map(|c| Self::cumulative_nbuffers(c))
.unwrap_or_default()
})
.sum();
let buffer_count = Self::cumulative_nbuffers(child);

Expand All @@ -119,7 +124,7 @@ impl<'a> ArrayView<'a> {
fn array_child(&self, idx: usize) -> Option<fb::Array<'a>> {
let children = self.array.children()?;
if idx < children.len() {
Some(children.get(idx))
children.get(idx).child()
} else {
None
}
Expand All @@ -134,7 +139,10 @@ impl<'a> ArrayView<'a> {
fn cumulative_nbuffers(array: fb::Array) -> usize {
let mut nbuffers = array.nbuffers() as usize;
for child in array.children().unwrap_or_default() {
nbuffers += Self::cumulative_nbuffers(child);
nbuffers += child
.child()
.map(|c| Self::cumulative_nbuffers(c))
.unwrap_or_default();
}
nbuffers
}
Expand Down
6 changes: 3 additions & 3 deletions vortex-array/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use vortex_schema::DType;
use crate::ptype::NativePType;
use crate::scalar::{ListScalarVec, Scalar};

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Stat {
BitWidthFreq,
TrailingZeroFreq,
Expand Down Expand Up @@ -146,7 +146,7 @@ impl StatsSet {
}

fn merge_scalar_stat(&mut self, other: &Self, stat: &Stat) {
match self.0.entry(stat.clone()) {
match self.0.entry(*stat) {
Entry::Occupied(mut e) => {
if let Some(other_value) = other.get_as::<usize>(stat).unwrap() {
let self_value: usize = e.get().try_into().unwrap();
Expand Down Expand Up @@ -228,7 +228,7 @@ impl<'a> Stats<'a> {
pub fn set_many(&self, other: &Stats, stats: Vec<&Stat>) {
stats.into_iter().for_each(|stat| {
if let Some(v) = other.get(stat) {
self.cache.write().unwrap().set(stat.clone(), v)
self.cache.write().unwrap().set(*stat, v)
}
});
}
Expand Down
29 changes: 17 additions & 12 deletions vortex-array2/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
[package]
name = "vortex-array2"
version.workspace = true
homepage.workspace = true
repository.workspace = true
authors.workspace = true
license.workspace = true
keywords.workspace = true
include.workspace = true
edition.workspace = true
rust-version.workspace = true
version = { workspace = true }
description = "Vortex in memory columnar data format"
homepage = { workspace = true }
repository = { workspace = true }
authors = { workspace = true }
license = { workspace = true }
keywords = { workspace = true }
include = { workspace = true }
edition = { workspace = true }
rust-version = { workspace = true }

[dependencies]
arrow-buffer = { workspace = true }
flatbuffers = { workspace = true }
flexbuffers = { workspace = true }
half = { workspace = true }
humansize = { workspace = true }
linkme = { workspace = true }
paste = { workspace = true }
vortex-array = { path = "../vortex-array" }
vortex-error = { path = "../vortex-error" }
serde = { workspace = true, features = ["derive"] }
vortex-array = { path = "../vortex-array", features = ["serde"] }
vortex-error = { path = "../vortex-error", features = ["flexbuffers"] }
vortex-flatbuffers = { path = "../vortex-flatbuffers" }
vortex-schema = { path = "../vortex-schema" }
vortex-schema = { path = "../vortex-schema", features = ["serde"] }

[lints]
workspace = true
Loading