Skip to content

Commit 36f209c

Browse files
authored
Merge pull request #5 from AdaWorldAPI/claude/setup-adaworld-repos-4kPEX
Claude/setup adaworld repos 4k pex
2 parents 543a4df + cff0a57 commit 36f209c

26 files changed

Lines changed: 7378 additions & 927 deletions

Cargo.lock

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

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
members = [
33
"crates/lance-graph",
44
"crates/lance-graph-catalog",
5-
"crates/lance-graph-python",
65
"crates/lance-graph-benches",
76
]
7+
exclude = [
8+
"crates/lance-graph-python",
9+
]
810
resolver = "2"

crates/lance-graph-catalog/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ keywords = ["lance", "graph", "catalog", "namespace"]
1111
categories = ["database", "data-structures", "science"]
1212

1313
[dependencies]
14-
arrow-schema = "56.2"
14+
arrow-schema = "57"
1515
async-trait = "0.1"
16-
datafusion = { version = "50.3", default-features = false }
17-
lance-namespace = "1.0.1"
16+
datafusion = { version = "51", default-features = false }
17+
lance-namespace = "2"
1818
reqwest = { version = "0.12", features = ["json"], optional = true }
1919
serde = { version = "1", features = ["derive"] }
2020
serde_json = "1"

crates/lance-graph-python/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ name = "_internal"
1010
crate-type = ["cdylib"]
1111

1212
[dependencies]
13-
arrow = { version = "56.2", features = ["pyarrow"] }
14-
arrow-array = "56.2"
15-
arrow-schema = "56.2"
16-
arrow-ipc = "56.2"
17-
datafusion = { version = "50.3", default-features = false }
13+
arrow = { version = "57", features = ["pyarrow"] }
14+
arrow-array = "57"
15+
arrow-schema = "57"
16+
arrow-ipc = "57"
17+
datafusion = { version = "51", default-features = false }
1818
futures = "0.3"
1919
lance-graph = { path = "../lance-graph" }
2020
serde = { version = "1", features = ["derive"] }

crates/lance-graph/Cargo.toml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ keywords = ["lance", "graph", "cypher", "query", "datafusion"]
1111
categories = ["database", "data-structures", "science"]
1212

1313
[dependencies]
14-
arrow = { version = "56.2", features = ["prettyprint"] }
15-
arrow-array = "56.2"
16-
arrow-schema = "56.2"
14+
arrow = { version = "57", features = ["prettyprint"] }
15+
arrow-array = "57"
16+
arrow-schema = "57"
1717
async-trait = "0.1"
18-
datafusion = { version = "50.3", default-features = false, features = [
18+
datafusion = { version = "51", default-features = false, features = [
1919
"nested_expressions",
2020
"regex_expressions",
2121
"unicode_expressions",
@@ -25,20 +25,20 @@ datafusion = { version = "50.3", default-features = false, features = [
2525
"string_expressions",
2626
"parquet",
2727
] }
28-
datafusion-common = "50.3"
29-
datafusion-expr = "50.3"
30-
datafusion-sql = "50.3"
31-
datafusion-functions-aggregate = "50.3"
28+
datafusion-common = "51"
29+
datafusion-expr = "51"
30+
datafusion-sql = "51"
31+
datafusion-functions-aggregate = "51"
3232
futures = "0.3"
3333
lance-graph-catalog = { path = "../lance-graph-catalog", version = "0.5.3" }
34-
lance = "1.0.0"
35-
lance-linalg = "1.0.0"
36-
lance-namespace = "1.0.1"
34+
lance = "2"
35+
lance-linalg = "2"
36+
lance-namespace = "2"
3737
nom = "7.1"
3838
serde = { version = "1", features = ["derive"] }
3939
serde_json = "1"
4040
snafu = "0.8"
41-
deltalake = { version = "0.29", features = ["datafusion", "s3", "azure", "gcs"], optional = true }
41+
deltalake = { version = "0.30", features = ["datafusion", "s3", "azure", "gcs"], optional = true }
4242
url = { version = "2", optional = true }
4343

4444
[features]
@@ -48,6 +48,7 @@ delta = ["dep:deltalake", "dep:url"]
4848

4949
[dev-dependencies]
5050
futures = "0.3"
51-
lance-arrow = "1.0.0"
51+
lance-arrow = "2"
52+
lance-index = "2"
5253
tempfile = "3"
5354
tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] }
Lines changed: 253 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
// SPDX-FileCopyrightText: Copyright The Lance Authors
3+
4+
//! # GraphBLAS Descriptors
5+
//!
6+
//! Descriptors control the behaviour of GraphBLAS operations, such as whether
7+
//! to transpose inputs, complement masks, or replace outputs.
8+
9+
use std::fmt;
10+
11+
/// Descriptor field identifiers.
12+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
13+
pub enum DescField {
14+
/// Controls the output container.
15+
Output,
16+
/// Controls the mask.
17+
Mask,
18+
/// Controls the first input.
19+
Input0,
20+
/// Controls the second input.
21+
Input1,
22+
}
23+
24+
/// Descriptor value for a given field.
25+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
26+
pub enum DescValue {
27+
/// Default behaviour (no modification).
28+
Default,
29+
/// Transpose the matrix operand.
30+
Transpose,
31+
/// Complement the mask (use structural complement).
32+
Complement,
33+
/// Replace mode: clear the output before writing results.
34+
Replace,
35+
/// Structure-only mask: ignore values, use pattern only.
36+
Structure,
37+
}
38+
39+
/// A descriptor that controls GraphBLAS operation behaviour.
40+
///
41+
/// Each field can be set independently. Unset fields default to [`DescValue::Default`].
42+
#[derive(Clone, PartialEq, Eq)]
43+
pub struct Descriptor {
44+
/// Output field setting.
45+
pub output: DescValue,
46+
/// Mask field setting.
47+
pub mask: DescValue,
48+
/// First input field setting.
49+
pub inp0: DescValue,
50+
/// Second input field setting.
51+
pub inp1: DescValue,
52+
}
53+
54+
impl Default for Descriptor {
55+
fn default() -> Self {
56+
Self {
57+
output: DescValue::Default,
58+
mask: DescValue::Default,
59+
inp0: DescValue::Default,
60+
inp1: DescValue::Default,
61+
}
62+
}
63+
}
64+
65+
impl fmt::Debug for Descriptor {
66+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
67+
f.debug_struct("Descriptor")
68+
.field("output", &self.output)
69+
.field("mask", &self.mask)
70+
.field("inp0", &self.inp0)
71+
.field("inp1", &self.inp1)
72+
.finish()
73+
}
74+
}
75+
76+
impl Descriptor {
77+
/// Create a new default descriptor.
78+
pub fn new() -> Self {
79+
Self::default()
80+
}
81+
82+
/// Set a descriptor field.
83+
pub fn set(&mut self, field: DescField, value: DescValue) -> &mut Self {
84+
match field {
85+
DescField::Output => self.output = value,
86+
DescField::Mask => self.mask = value,
87+
DescField::Input0 => self.inp0 = value,
88+
DescField::Input1 => self.inp1 = value,
89+
}
90+
self
91+
}
92+
93+
/// Get the value of a descriptor field.
94+
pub fn get(&self, field: DescField) -> DescValue {
95+
match field {
96+
DescField::Output => self.output,
97+
DescField::Mask => self.mask,
98+
DescField::Input0 => self.inp0,
99+
DescField::Input1 => self.inp1,
100+
}
101+
}
102+
103+
/// Whether the first input should be transposed.
104+
pub fn transpose_input0(&self) -> bool {
105+
self.inp0 == DescValue::Transpose
106+
}
107+
108+
/// Whether the second input should be transposed.
109+
pub fn transpose_input1(&self) -> bool {
110+
self.inp1 == DescValue::Transpose
111+
}
112+
113+
/// Whether the mask should be complemented.
114+
pub fn complement_mask(&self) -> bool {
115+
self.mask == DescValue::Complement
116+
}
117+
118+
/// Whether the output should be replaced (cleared before writing).
119+
pub fn replace_output(&self) -> bool {
120+
self.output == DescValue::Replace
121+
}
122+
123+
/// Whether the mask is structure-only.
124+
pub fn structure_mask(&self) -> bool {
125+
self.mask == DescValue::Structure
126+
}
127+
}
128+
129+
/// Pre-built descriptor constants.
130+
#[allow(non_snake_case)]
131+
pub mod GrBDesc {
132+
use super::*;
133+
134+
/// Default descriptor — no modifications.
135+
pub fn default() -> Descriptor {
136+
Descriptor::default()
137+
}
138+
139+
/// Transpose the first input.
140+
pub fn t0() -> Descriptor {
141+
let mut d = Descriptor::default();
142+
d.set(DescField::Input0, DescValue::Transpose);
143+
d
144+
}
145+
146+
/// Transpose the second input.
147+
pub fn t1() -> Descriptor {
148+
let mut d = Descriptor::default();
149+
d.set(DescField::Input1, DescValue::Transpose);
150+
d
151+
}
152+
153+
/// Transpose both inputs.
154+
pub fn t0t1() -> Descriptor {
155+
let mut d = Descriptor::default();
156+
d.set(DescField::Input0, DescValue::Transpose);
157+
d.set(DescField::Input1, DescValue::Transpose);
158+
d
159+
}
160+
161+
/// Complement the mask.
162+
pub fn comp() -> Descriptor {
163+
let mut d = Descriptor::default();
164+
d.set(DescField::Mask, DescValue::Complement);
165+
d
166+
}
167+
168+
/// Replace the output.
169+
pub fn replace() -> Descriptor {
170+
let mut d = Descriptor::default();
171+
d.set(DescField::Output, DescValue::Replace);
172+
d
173+
}
174+
175+
/// Replace the output and complement the mask.
176+
pub fn replace_comp() -> Descriptor {
177+
let mut d = Descriptor::default();
178+
d.set(DescField::Output, DescValue::Replace);
179+
d.set(DescField::Mask, DescValue::Complement);
180+
d
181+
}
182+
183+
/// Structure-only mask.
184+
pub fn structure() -> Descriptor {
185+
let mut d = Descriptor::default();
186+
d.set(DescField::Mask, DescValue::Structure);
187+
d
188+
}
189+
}
190+
191+
#[cfg(test)]
192+
mod tests {
193+
use super::*;
194+
195+
#[test]
196+
fn test_default_descriptor() {
197+
let d = Descriptor::default();
198+
assert_eq!(d.get(DescField::Output), DescValue::Default);
199+
assert_eq!(d.get(DescField::Mask), DescValue::Default);
200+
assert_eq!(d.get(DescField::Input0), DescValue::Default);
201+
assert_eq!(d.get(DescField::Input1), DescValue::Default);
202+
assert!(!d.transpose_input0());
203+
assert!(!d.transpose_input1());
204+
assert!(!d.complement_mask());
205+
assert!(!d.replace_output());
206+
}
207+
208+
#[test]
209+
fn test_set_fields() {
210+
let mut d = Descriptor::new();
211+
d.set(DescField::Input0, DescValue::Transpose);
212+
assert!(d.transpose_input0());
213+
assert!(!d.transpose_input1());
214+
215+
d.set(DescField::Mask, DescValue::Complement);
216+
assert!(d.complement_mask());
217+
}
218+
219+
#[test]
220+
fn test_presets() {
221+
let t0 = GrBDesc::t0();
222+
assert!(t0.transpose_input0());
223+
assert!(!t0.transpose_input1());
224+
225+
let t1 = GrBDesc::t1();
226+
assert!(!t1.transpose_input0());
227+
assert!(t1.transpose_input1());
228+
229+
let t0t1 = GrBDesc::t0t1();
230+
assert!(t0t1.transpose_input0());
231+
assert!(t0t1.transpose_input1());
232+
233+
let comp = GrBDesc::comp();
234+
assert!(comp.complement_mask());
235+
236+
let repl = GrBDesc::replace();
237+
assert!(repl.replace_output());
238+
239+
let rc = GrBDesc::replace_comp();
240+
assert!(rc.replace_output());
241+
assert!(rc.complement_mask());
242+
243+
let s = GrBDesc::structure();
244+
assert!(s.structure_mask());
245+
}
246+
247+
#[test]
248+
fn test_debug_format() {
249+
let d = GrBDesc::t0();
250+
let s = format!("{:?}", d);
251+
assert!(s.contains("Transpose"));
252+
}
253+
}

0 commit comments

Comments
 (0)