@@ -1117,8 +1117,6 @@ impl LogicalPlanBuilder {
1117
1117
. collect :: < Result < _ > > ( ) ?;
1118
1118
1119
1119
let on: Vec < ( _ , _ ) > = left_keys. into_iter ( ) . zip ( right_keys) . collect ( ) ;
1120
- let join_schema =
1121
- build_join_schema ( self . plan . schema ( ) , right. schema ( ) , & join_type) ?;
1122
1120
let mut join_on: Vec < ( Expr , Expr ) > = vec ! [ ] ;
1123
1121
let mut filters: Option < Expr > = None ;
1124
1122
for ( l, r) in & on {
@@ -1151,33 +1149,33 @@ impl LogicalPlanBuilder {
1151
1149
DataFusionError :: Internal ( "filters should not be None here" . to_string ( ) )
1152
1150
} ) ?)
1153
1151
} else {
1154
- Ok ( Self :: new ( LogicalPlan :: Join ( Join {
1155
- left : self . plan ,
1156
- right : Arc :: new ( right) ,
1157
- on : join_on,
1158
- filter : filters,
1152
+ let join = Join :: try_new (
1153
+ self . plan ,
1154
+ Arc :: new ( right) ,
1155
+ join_on,
1156
+ filters,
1159
1157
join_type,
1160
- join_constraint : JoinConstraint :: Using ,
1161
- schema : DFSchemaRef :: new ( join_schema) ,
1162
- null_equals_null : false ,
1163
- } ) ) )
1158
+ JoinConstraint :: Using ,
1159
+ false ,
1160
+ ) ?;
1161
+
1162
+ Ok ( Self :: new ( LogicalPlan :: Join ( join) ) )
1164
1163
}
1165
1164
}
1166
1165
1167
1166
/// Apply a cross join
1168
1167
pub fn cross_join ( self , right : LogicalPlan ) -> Result < Self > {
1169
- let join_schema =
1170
- build_join_schema ( self . plan . schema ( ) , right. schema ( ) , & JoinType :: Inner ) ?;
1171
- Ok ( Self :: new ( LogicalPlan :: Join ( Join {
1172
- left : self . plan ,
1173
- right : Arc :: new ( right) ,
1174
- on : vec ! [ ] ,
1175
- filter : None ,
1176
- join_type : JoinType :: Inner ,
1177
- join_constraint : JoinConstraint :: On ,
1178
- null_equals_null : false ,
1179
- schema : DFSchemaRef :: new ( join_schema) ,
1180
- } ) ) )
1168
+ let join = Join :: try_new (
1169
+ self . plan ,
1170
+ Arc :: new ( right) ,
1171
+ vec ! [ ] ,
1172
+ None ,
1173
+ JoinType :: Inner ,
1174
+ JoinConstraint :: On ,
1175
+ false ,
1176
+ ) ?;
1177
+
1178
+ Ok ( Self :: new ( LogicalPlan :: Join ( join) ) )
1181
1179
}
1182
1180
1183
1181
/// Repartition
@@ -1338,7 +1336,7 @@ impl LogicalPlanBuilder {
1338
1336
/// to columns from the existing input. `r`, the second element of the tuple,
1339
1337
/// must only refer to columns from the right input.
1340
1338
///
1341
- /// `filter` contains any other other filter expression to apply during the
1339
+ /// `filter` contains any other filter expression to apply during the
1342
1340
/// join. Note that `equi_exprs` predicates are evaluated more efficiently
1343
1341
/// than the filter expressions, so they are preferred.
1344
1342
pub fn join_with_expr_keys (
@@ -1388,19 +1386,17 @@ impl LogicalPlanBuilder {
1388
1386
} )
1389
1387
. collect :: < Result < Vec < _ > > > ( ) ?;
1390
1388
1391
- let join_schema =
1392
- build_join_schema ( self . plan . schema ( ) , right. schema ( ) , & join_type) ?;
1393
-
1394
- Ok ( Self :: new ( LogicalPlan :: Join ( Join {
1395
- left : self . plan ,
1396
- right : Arc :: new ( right) ,
1397
- on : join_key_pairs,
1389
+ let join = Join :: try_new (
1390
+ self . plan ,
1391
+ Arc :: new ( right) ,
1392
+ join_key_pairs,
1398
1393
filter,
1399
1394
join_type,
1400
- join_constraint : JoinConstraint :: On ,
1401
- schema : DFSchemaRef :: new ( join_schema) ,
1402
- null_equals_null : false ,
1403
- } ) ) )
1395
+ JoinConstraint :: On ,
1396
+ false ,
1397
+ ) ?;
1398
+
1399
+ Ok ( Self :: new ( LogicalPlan :: Join ( join) ) )
1404
1400
}
1405
1401
1406
1402
/// Unnest the given column.
0 commit comments