martin-g commented on code in PR #19379:
URL: https://github.com/apache/datafusion/pull/19379#discussion_r2630209354


##########
datafusion/proto/tests/cases/roundtrip_physical_plan.rs:
##########
@@ -2372,3 +2372,31 @@ fn roundtrip_hash_table_lookup_expr_to_lit() -> 
Result<()> {
 
     Ok(())
 }
+
+#[test]
+fn roundtrip_hash_expr() -> Result<()> {
+    use datafusion::physical_plan::joins::{HashExpr, SeededRandomState};
+
+    let schema = Arc::new(Schema::new(vec![
+        Field::new("a", DataType::Int64, false),
+        Field::new("b", DataType::Utf8, false),
+    ]));
+
+    // Create a HashExpr with test columns and seeds
+    let on_columns = vec![col("a", &schema)?, col("b", &schema)?];
+    let hash_expr: Arc<dyn PhysicalExpr> = Arc::new(HashExpr::new(
+        on_columns,
+        SeededRandomState::with_seeds(0, 0, 0, 0), // repartition seeds
+        "test_hash".to_string(),
+    ));
+
+    // Wrap in a filter by comparing hash value to a literal
+    // hash_expr > 0 is always boolean
+    let filter_expr = binary(hash_expr, Operator::Gt, lit(0u64), &schema)?;
+    let filter = Arc::new(FilterExec::try_new(
+        filter_expr,
+        Arc::new(EmptyExec::new(schema)),
+    )?);
+
+    roundtrip_test(filter)

Review Comment:
   The roundtrip compares the Debug 
[representations](https://github.com/pydantic/datafusion/blob/2c89b17f00b362c41df209f4ddae252728431c8e/datafusion/proto/tests/cases/roundtrip_physical_plan.rs#L153-L156)
 of the input and output, but the random_state is not 
[printed](https://github.com/apache/datafusion/pull/19379/changes#diff-c89cc13760a9e27ff7901446ad0982fab905ae292b57803b53f749603168c7b6R127),
 so the seed is not asserted.



##########
datafusion/physical-plan/src/joins/hash_join/partitioned_hash_eval.rs:
##########
@@ -211,8 +263,7 @@ impl Hash for HashTableLookupExpr {
 
 impl PartialEq for HashTableLookupExpr {
     fn eq(&self, other: &Self) -> bool {
-        Arc::ptr_eq(&self.hash_expr, &other.hash_expr)
-            && self.description == other.description
+        self.hash_expr.dyn_eq(&other.hash_expr) && self.description == 
other.description

Review Comment:
   Shouldn't this be:
   
   ```suggestion
           self.hash_expr.dyn_eq(&other.hash_expr.as_any()) && self.description 
== other.description
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to