This is an automated email from the ASF dual-hosted git repository.

agrove pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/master by this push:
     new e5ae1ead6 Implement serde for join filter (#2649)
e5ae1ead6 is described below

commit e5ae1ead6812e36245e379848a45b0078a6b1235
Author: Andy Grove <[email protected]>
AuthorDate: Mon May 30 09:09:04 2022 -0600

    Implement serde for join filter (#2649)
---
 datafusion/proto/proto/datafusion.proto |  1 +
 datafusion/proto/src/logical_plan.rs    | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/datafusion/proto/proto/datafusion.proto 
b/datafusion/proto/proto/datafusion.proto
index c2ddfa1b9..a990e175d 100644
--- a/datafusion/proto/proto/datafusion.proto
+++ b/datafusion/proto/proto/datafusion.proto
@@ -230,6 +230,7 @@ message JoinNode {
   repeated datafusion.Column left_join_column = 5;
   repeated datafusion.Column right_join_column = 6;
   bool null_equals_null = 7;
+  LogicalExprNode filter = 8;
 }
 
 message UnionNode {
diff --git a/datafusion/proto/src/logical_plan.rs 
b/datafusion/proto/src/logical_plan.rs
index 4993cfdce..bf557be88 100644
--- a/datafusion/proto/src/logical_plan.rs
+++ b/datafusion/proto/src/logical_plan.rs
@@ -605,6 +605,11 @@ impl AsLogicalPlan for LogicalPlanNode {
                         join.join_constraint
                     ))
                 })?;
+                let filter: Option<Expr> = join
+                    .filter
+                    .as_ref()
+                    .map(|expr| parse_expr(expr, ctx))
+                    .map_or(Ok(None), |v| v.map(Some))?;
 
                 let builder = LogicalPlanBuilder::from(into_logical_plan!(
                     join.left,
@@ -616,7 +621,7 @@ impl AsLogicalPlan for LogicalPlanNode {
                         &into_logical_plan!(join.right, ctx, extension_codec)?,
                         join_type.into(),
                         (left_keys, right_keys),
-                        None, // filter
+                        filter,
                     )?,
                     JoinConstraint::Using => builder.join_using(
                         &into_logical_plan!(join.right, ctx, extension_codec)?,
@@ -864,6 +869,7 @@ impl AsLogicalPlan for LogicalPlanNode {
                 left,
                 right,
                 on,
+                filter,
                 join_type,
                 join_constraint,
                 null_equals_null,
@@ -884,6 +890,10 @@ impl AsLogicalPlan for LogicalPlanNode {
                 let join_type: protobuf::JoinType = 
join_type.to_owned().into();
                 let join_constraint: protobuf::JoinConstraint =
                     join_constraint.to_owned().into();
+                let filter = filter
+                    .as_ref()
+                    .map(|e| e.try_into())
+                    .map_or(Ok(None), |v| v.map(Some))?;
                 Ok(protobuf::LogicalPlanNode {
                     logical_plan_type: Some(LogicalPlanType::Join(Box::new(
                         protobuf::JoinNode {
@@ -894,6 +904,7 @@ impl AsLogicalPlan for LogicalPlanNode {
                             left_join_column,
                             right_join_column,
                             null_equals_null: *null_equals_null,
+                            filter,
                         },
                     ))),
                 })

Reply via email to