pub trait CustomValue:
Any
+ Send
+ Sync
+ Debug {
// Required methods
fn as_any(&self) -> &dyn Any;
fn deep_clone(&self) -> Arc<dyn CustomValue>;
fn eq_box(&self, other: &dyn CustomValue) -> bool;
}Expand description
§Custom Value
Trait for any object that can be stored in enums::Value::Custom.
CustomValue extends MinArrow’s Value universe, allowing engines or
analytics to handle intermediate states and custom types
within the same pipeline abstraction as scalars, arrays, and tables.
You must then manage downcasting on top of the base enum match, so it it’s not the most ergonomic situation, but is available.
Typical use cases include:
- Accumulators, partial aggregates, or sketches.
- Custom algorithm outputs.
- Arbitrary user-defined types requiring unified pipeline integration.
Dynamic dispatch and downcasting are used at runtime to recover the inner type and perform type-specific logic, such as merging, reduction, or finalisation.
§Implementation Notes:
- Manual implementation is not required.
- Any type that implements
Debug,Clone,PartialEq, and isSend + Sync + 'staticautomatically satisfiesCustomValuevia the blanket impl. Anyis automatically implemented by Rust for all'statictypes.
§Borrowing Constraints:
- Borrowed types cannot be used in
Value::Customdirectly, sinceAnyrequires'static. - To store borrowed data, first promote it to an owned type or wrap it in
Arc.
Required Methods§
Sourcefn deep_clone(&self) -> Arc<dyn CustomValue>
fn deep_clone(&self) -> Arc<dyn CustomValue>
Returns a deep clone of the object.
Additionally, the Value enum automatically derives Clone, which is a
shallow Arc clone by default.
Sourcefn eq_box(&self, other: &dyn CustomValue) -> bool
fn eq_box(&self, other: &dyn CustomValue) -> bool
Performs semantic equality on the boxed object.
This enables PartialEq to be implemented for Value,
since dyn CustomValue cannot use == directly.