Skip to content

Commit

Permalink
Add public accessors to query condition data (#198)
Browse files Browse the repository at this point in the history
* Fix ExtendedEnumeration derive

* Add pub fns to access query condition data
  • Loading branch information
rroelke authored Feb 13, 2025
1 parent 352b59c commit 637bf2f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tiledb/api/src/array/enumeration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ impl Debug for Enumeration {

/// Wraps an [Enumeration] which has been created by [Enumeration::extend].
/// This can be added to a [SchemaEvolution].
#[derive(Debug)]
#[cfg_attr(any(test, feature = "pod"), derive(Debug))]
pub struct ExtendedEnumeration(Enumeration);

impl ExtendedEnumeration {
Expand Down
32 changes: 32 additions & 0 deletions tiledb/api/src/query/condition/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,18 @@ pub struct EqualityPredicate {
}

impl EqualityPredicate {
pub fn field(&self) -> &str {
&self.field
}

pub fn operation(&self) -> EqualityOp {
self.op
}

pub fn value(&self) -> &Literal {
&self.value
}

fn build(&self, ctx: &Context) -> TileDBResult<RawQueryCondition> {
let mut c_cond: *mut ffi::tiledb_query_condition_t = out_ptr!();
ctx.capi_call(|ctx| unsafe {
Expand Down Expand Up @@ -518,6 +530,18 @@ pub struct SetMembershipPredicate {
}

impl SetMembershipPredicate {
pub fn field(&self) -> &str {
&self.field
}

pub fn operation(&self) -> SetMembershipOp {
self.op
}

pub fn members(&self) -> &SetMembers {
&self.members
}

fn build(&self, ctx: &Context) -> TileDBResult<RawQueryCondition> {
// First things first, sets require a non-zero length vector. I would
// prefer if we couldn't even create SetMemberValues with zero length
Expand Down Expand Up @@ -629,6 +653,14 @@ pub struct NullnessPredicate {
}

impl NullnessPredicate {
pub fn field(&self) -> &str {
&self.field
}

pub fn operation(&self) -> NullnessOp {
self.op
}

fn build(&self, ctx: &Context) -> TileDBResult<RawQueryCondition> {
let mut c_cond: *mut ffi::tiledb_query_condition_t = out_ptr!();
ctx.capi_call(|ctx| unsafe {
Expand Down

0 comments on commit 637bf2f

Please sign in to comment.