@@ -26,8 +26,8 @@ use datafusion::logical_plan::window_frames::{
2626} ;
2727use datafusion:: logical_plan:: {
2828 abs, acos, asin, atan, ceil, cos, exp, floor, ln, log10, log2, round, signum, sin,
29- sqrt, tan, trunc, Column , DFField , DFSchema , Expr , JoinType , LogicalPlan ,
30- LogicalPlanBuilder , Operator ,
29+ sqrt, tan, trunc, Column , DFField , DFSchema , Expr , JoinConstraint , JoinType ,
30+ LogicalPlan , LogicalPlanBuilder , Operator ,
3131} ;
3232use datafusion:: physical_plan:: aggregates:: AggregateFunction ;
3333use datafusion:: physical_plan:: csv:: CsvReadOptions ;
@@ -257,23 +257,34 @@ impl TryInto<LogicalPlan> for &protobuf::LogicalPlanNode {
257257 join. join_type
258258 ) )
259259 } ) ?;
260- let join_type = match join_type {
261- protobuf:: JoinType :: Inner => JoinType :: Inner ,
262- protobuf:: JoinType :: Left => JoinType :: Left ,
263- protobuf:: JoinType :: Right => JoinType :: Right ,
264- protobuf:: JoinType :: Full => JoinType :: Full ,
265- protobuf:: JoinType :: Semi => JoinType :: Semi ,
266- protobuf:: JoinType :: Anti => JoinType :: Anti ,
267- } ;
268- LogicalPlanBuilder :: from ( convert_box_required ! ( join. left) ?)
269- . join (
260+ let join_constraint = protobuf:: JoinConstraint :: from_i32 (
261+ join. join_constraint ,
262+ )
263+ . ok_or_else ( || {
264+ proto_error ( format ! (
265+ "Received a JoinNode message with unknown JoinConstraint {}" ,
266+ join. join_constraint
267+ ) )
268+ } ) ?;
269+
270+ let builder =
271+ LogicalPlanBuilder :: from ( & convert_box_required ! ( join. left) ?) ;
272+
273+ let builder = match join_constraint. into ( ) {
274+ JoinConstraint :: On => builder. join (
270275 & convert_box_required ! ( join. right) ?,
271- join_type,
276+ join_type. into ( ) ,
272277 left_keys,
273278 right_keys,
274- ) ?
275- . build ( )
276- . map_err ( |e| e. into ( ) )
279+ ) ?,
280+ JoinConstraint :: Using => builder. join_using (
281+ & convert_box_required ! ( join. right) ?,
282+ join_type. into ( ) ,
283+ left_keys,
284+ ) ?,
285+ } ;
286+
287+ builder. build ( ) . map_err ( |e| e. into ( ) )
277288 }
278289 }
279290 }
0 commit comments