zanmato1984 commented on code in PR #48272:
URL: https://github.com/apache/arrow/pull/48272#discussion_r2567589811


##########
cpp/src/arrow/acero/hash_join_node_test.cc:
##########
@@ -2369,8 +2404,8 @@ TEST(HashJoin, FineGrainedResidualFilter) {
   {
     // Literal false, null, and scalar false, null.
     for (Expression filter :
-         {literal(false), literal(NullScalar()), equal(literal(0), literal(1)),

Review Comment:
   The null type null (`literal(NullScalar())`) is invalid. Replacing it with a 
boolean type `null`.



##########
cpp/src/arrow/acero/hash_join_node.cc:
##########
@@ -370,9 +370,19 @@ Result<Expression> HashJoinSchema::BindFilter(Expression 
filter,
                                               const Schema& left_schema,
                                               const Schema& right_schema,
                                               ExecContext* exec_context) {
-  if (filter.IsBound() || filter == literal(true)) {
+  auto ValidateFilterTypeAndReturn = [](Expression filter) -> 
Result<Expression> {
+    if (filter.type()->id() != Type::BOOL) {
+      return Status::TypeError("Filter expression must evaluate to bool, but ",
+                               filter.ToString(), " evaluates to ",
+                               filter.type()->ToString());
+    }
     return filter;
+  };
+
+  if (filter.IsBound()) {

Review Comment:
   `IsBound()` is implied by `literal(true)` so one check should suffice.



-- 
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]

Reply via email to