Skip to content

Apache DataFusion SQL Query Engine

Link UdfEq and PtrEq to help understand relationship. (#17082)

Piotr Findeisen407a965d3740
diff --git a/datafusion/expr/src/ptr_eq.rs b/datafusion/expr/src/ptr_eq.rs
index c85b3d9950..0bbfba5e8d 100644
--- a/datafusion/expr/src/ptr_eq.rs
+++ b/datafusion/expr/src/ptr_eq.rs
@@ -36,6 +36,8 @@ pub fn arc_ptr_hash<T: ?Sized>(a: &Arc<T>, hasher: &mut impl Hasher) {
/// A wrapper around a pointer that implements `Eq` and `Hash` comparing
/// the underlying pointer address.
+///
+/// If you have pointers to a `dyn UDF impl` consider using [`super::udf_eq::UdfEq`].
#[derive(Clone)]
#[allow(private_bounds)] // This is so that PtrEq can only be used with allowed pointer types (e.g. Arc), without allowing misuse.
pub struct PtrEq<Ptr: PointerType>(Ptr);
diff --git a/datafusion/expr/src/udf_eq.rs b/datafusion/expr/src/udf_eq.rs
index 1871aab3fd..75d6a41c36 100644
--- a/datafusion/expr/src/udf_eq.rs
+++ b/datafusion/expr/src/udf_eq.rs
@@ -23,6 +23,8 @@ use std::sync::Arc;
/// A wrapper around a pointer to UDF that implements `Eq` and `Hash` delegating to
/// corresponding methods on the UDF trait.
+///
+/// If you want to just compare pointers for equality, use [`super::ptr_eq::PtrEq`].
#[derive(Clone)]
#[allow(private_bounds)] // This is so that UdfEq can only be used with allowed pointer types (e.g. Arc), without allowing misuse.
pub struct UdfEq<Ptr: UdfPointer>(Ptr);