Skip to content

Commit fb6627c

Browse files
committed
Merge vaccum_fab into vacuum
2 parents ab73b77 + 247283c commit fb6627c

File tree

18 files changed

+763
-138
lines changed

18 files changed

+763
-138
lines changed

Cargo.lock

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ parquet = { version = "56.2.0" }
159159
arrow-json = { version = "56.2.0" }
160160
arrow-buffer = { version = "56.2.0" }
161161
arrow-schema = { version = "56.2.0" }
162+
serde_arrow = {version = "0.13.6", features = ["arrow-56"]}
162163
arrow-array = { version = "56.2.0", features = ["chrono-tz"] }
163164
arrow-ipc = { version = "56.2.0" }
164165
arrow-csv = { version = "56.2.0" }

db4-storage/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ arrow.workspace = true
2828
arrow-array.workspace = true
2929
arrow-csv.workspace = true
3030
arrow-schema.workspace = true
31+
serde_arrow.workspace = true
3132
parquet.workspace = true
3233
bytemuck.workspace = true
3334
rayon.workspace = true

db4-storage/src/pages/test_utils/checkers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ pub fn check_graph_with_nodes_support<
297297
let actual_prop = actual_props
298298
.unwrap_or_else(|| panic!("Failed to get prop {name} for {node:?}"));
299299
assert!(
300-
const_props.contains(&actual_prop),
300+
const_props.iter().any(|c_prop| c_prop == &actual_prop),
301301
"failed to get const prop {name} for {node:?}, expected {const_props:?}, got {actual_prop:?}"
302302
);
303303
}

db4-storage/src/pages/test_utils/fixtures.rs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub fn edges_strat(size: usize) -> impl Strategy<Value = Vec<(VID, VID)>> {
9999
let srcs = (0usize..num_nodes).prop_map(VID);
100100
let dsts = (0usize..num_nodes).prop_map(VID);
101101
num_edges.prop_flat_map(move |num_edges| {
102-
collection::vec((srcs.clone(), dsts.clone()), num_edges as usize)
102+
collection::vec((srcs.clone(), dsts.clone()), num_edges)
103103
})
104104
})
105105
}
@@ -121,19 +121,16 @@ pub fn edges_strat_with_layers(
121121
})
122122
}
123123

124-
pub fn build_raw_edges(
125-
len: usize,
126-
num_nodes: usize,
127-
) -> impl Strategy<
128-
Value = Vec<(
129-
VID,
130-
VID,
131-
i64,
132-
Vec<(String, Prop)>,
133-
Vec<(String, Prop)>,
134-
Option<&'static str>,
135-
)>,
136-
> {
124+
pub type EdgeValues = (
125+
VID,
126+
VID,
127+
i64,
128+
Vec<(String, Prop)>,
129+
Vec<(String, Prop)>,
130+
Option<&'static str>,
131+
);
132+
133+
pub fn build_raw_edges(len: usize, num_nodes: usize) -> impl Strategy<Value = Vec<EdgeValues>> {
137134
proptest::collection::hash_map((0i32..1000).prop_map(|i| i.to_string()), prop_type(), 0..20)
138135
.prop_flat_map(move |schema| {
139136
let (t_props, c_props) = make_props(&schema);

db4-storage/src/pages/test_utils/props.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ pub fn prop_type() -> impl Strategy<Value = PropType> {
1919
PropType::Decimal { scale: 7 }, // decimal breaks the tests because of polars-parquet
2020
]);
2121

22-
// leaf.prop_recursive(3, 10, 10, |inner| {
23-
// let dict = proptest::collection::hash_map(r"\w{1,10}", inner.clone(), 1..10)
24-
// .prop_map(|map| PropType::map(map));
25-
// let list = inner
26-
// .clone()
27-
// .prop_map(|p_type| PropType::List(Box::new(p_type)));
28-
// prop_oneof![inner, list, dict]
29-
// })
30-
leaf
22+
leaf.prop_recursive(3, 10, 10, |inner| {
23+
let dict = proptest::collection::hash_map(r"\w{1,10}", inner.clone(), 1..10)
24+
.prop_map(PropType::map);
25+
// let list = inner
26+
// .clone()
27+
// .prop_map(|p_type| PropType::List(Box::new(p_type)));
28+
// prop_oneof![inner, list, dict]
29+
prop_oneof![inner, dict]
30+
})
3131
}
3232

3333
pub fn make_props(

db4-storage/src/properties/mod.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use arrow_schema::DECIMAL128_MAX_PRECISION;
77
use bigdecimal::ToPrimitive;
88
use raphtory_api::core::entities::properties::{
99
meta::PropMapper,
10-
prop::{Prop, PropType},
10+
prop::{Prop, PropType, SerdeMap, arrow_dtype_from_prop_type, struct_array_from_props},
1111
};
1212
use raphtory_core::{
1313
entities::{
@@ -197,7 +197,20 @@ impl Properties {
197197
}
198198
// PropColumn::Array(lazy_vec) => todo!(),
199199
// PropColumn::List(lazy_vec) => todo!(),
200-
// PropColumn::Map(lazy_vec) => todo!(),
200+
PropColumn::Map(lazy_vec) => {
201+
let dt = meta
202+
.get_dtype(col_id)
203+
.as_ref()
204+
.map(arrow_dtype_from_prop_type)
205+
.unwrap();
206+
let array_iter = indices
207+
.map(|i| lazy_vec.get_opt(i))
208+
.map(|e| e.map(|m| SerdeMap(m)));
209+
210+
let struct_array = struct_array_from_props(&dt, |sm| *sm, array_iter);
211+
212+
Some(Arc::new(struct_array))
213+
}
201214
_ => None, //todo!("Unsupported column type"),
202215
}
203216
}
@@ -234,7 +247,7 @@ impl Properties {
234247
}
235248
}
236249

237-
pub(crate) fn t_len(&self) -> usize {
250+
pub fn t_len(&self) -> usize {
238251
self.t_properties.len()
239252
}
240253

raphtory-api/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ sorted_vector_map = { workspace = true }
3737
arrow-array = { workspace = true, optional = true }
3838
arrow-ipc = { workspace = true, optional = true }
3939
arrow-schema = { workspace = true, optional = true }
40+
serde_arrow = { workspace = true, optional = true }
4041
itertools = { workspace = true }
4142
iter-enum = { workspace = true }
4243
minijinja = { workspace = true, optional = true }
@@ -46,7 +47,7 @@ display-error-chain = { workspace = true, optional = true }
4647
proptest.workspace = true
4748

4849
[features]
49-
default = []
50+
default = ["arrow"]
5051
# Enables generating the pyo3 python bindings
5152
python = [
5253
"dep:pyo3", "dep:pyo3-arrow", "dep:display-error-chain"
@@ -55,6 +56,6 @@ python = [
5556
proto = []
5657
vectors = []
5758
template = ["dep:minijinja"]
58-
arrow = ["dep:arrow-array", "dep:arrow-ipc", "dep:arrow-schema"]
59+
arrow = ["dep:arrow-array", "dep:arrow-ipc", "dep:arrow-schema", "dep:serde_arrow"]
5960
search = []
6061
io = ["dep:serde_json"]

0 commit comments

Comments
 (0)