Skip to content

Commit 9022c06

Browse files
committed
Protobuf implementations with roundrobin tests (#193)
* Protobuf implementations with roundrobin * Proto * Update mod.rs
1 parent 425d340 commit 9022c06

4 files changed

Lines changed: 338 additions & 19 deletions

File tree

‎datafusion/physical-plan/src/joins/sliding_hash_join.rs‎

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ pub struct SlidingHashJoinExec {
162162
/// If null_equals_null is true, null == null else null != null
163163
pub(crate) null_equals_null: bool,
164164
/// Left side sort expression(s)
165-
left_sort_exprs: Vec<PhysicalSortExpr>,
165+
pub(crate) left_sort_exprs: Vec<PhysicalSortExpr>,
166166
/// Right side sort expression(s)
167-
right_sort_exprs: Vec<PhysicalSortExpr>,
167+
pub(crate) right_sort_exprs: Vec<PhysicalSortExpr>,
168168
/// The output ordering
169169
output_ordering: Option<Vec<PhysicalSortExpr>>,
170170
/// Partition mode
@@ -309,6 +309,50 @@ impl SlidingHashJoinExec {
309309
),
310310
]
311311
}
312+
/// left (build) side which gets hashed
313+
pub fn left(&self) -> &Arc<dyn ExecutionPlan> {
314+
&self.left
315+
}
316+
317+
/// right (probe) side which are filtered by the hash table
318+
pub fn right(&self) -> &Arc<dyn ExecutionPlan> {
319+
&self.right
320+
}
321+
322+
/// Set of common columns used to join on
323+
pub fn on(&self) -> &[(Column, Column)] {
324+
&self.on
325+
}
326+
327+
/// Filters applied before join output
328+
pub fn filter(&self) -> &JoinFilter {
329+
&self.filter
330+
}
331+
332+
/// How the join is performed
333+
pub fn join_type(&self) -> &JoinType {
334+
&self.join_type
335+
}
336+
337+
/// The partitioning mode of this hash join
338+
pub fn partition_mode(&self) -> &StreamJoinPartitionMode {
339+
&self.mode
340+
}
341+
342+
/// Get null_equals_null
343+
pub fn null_equals_null(&self) -> bool {
344+
self.null_equals_null
345+
}
346+
347+
/// Get left_sort_exprs
348+
pub fn left_sort_exprs(&self) -> &Vec<PhysicalSortExpr> {
349+
&self.left_sort_exprs
350+
}
351+
352+
/// Get right_sort_exprs
353+
pub fn right_sort_exprs(&self) -> &Vec<PhysicalSortExpr> {
354+
&self.right_sort_exprs
355+
}
312356
}
313357

314358
impl DisplayAs for SlidingHashJoinExec {

‎datafusion/physical-plan/src/joins/sliding_nested_loop_join.rs‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,12 +230,12 @@ impl SlidingNestedLoopJoinExec {
230230
})
231231
}
232232

233-
/// left (build) side
233+
/// left (build) side which gets hashed
234234
pub fn left(&self) -> &Arc<dyn ExecutionPlan> {
235235
&self.left
236236
}
237237

238-
/// right (probe) side
238+
/// right (probe) side which are filtered by the hash table
239239
pub fn right(&self) -> &Arc<dyn ExecutionPlan> {
240240
&self.right
241241
}
@@ -250,6 +250,16 @@ impl SlidingNestedLoopJoinExec {
250250
&self.join_type
251251
}
252252

253+
/// Get left_sort_exprs
254+
pub fn left_sort_exprs(&self) -> &Vec<PhysicalSortExpr> {
255+
&self.left_sort_exprs
256+
}
257+
258+
/// Get right_sort_exprs
259+
pub fn right_sort_exprs(&self) -> &Vec<PhysicalSortExpr> {
260+
&self.right_sort_exprs
261+
}
262+
253263
/// Calculate order preservation flags for this join.
254264
fn maintains_input_order(join_type: JoinType) -> Vec<bool> {
255265
vec![

‎datafusion/proto/proto/datafusion.proto‎

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,6 +1166,8 @@ message PhysicalPlanNode {
11661166
SymmetricHashJoinExecNode symmetric_hash_join = 25;
11671167
InterleaveExecNode interleave = 26;
11681168
PlaceholderRowExecNode placeholder_row = 27;
1169+
SlidingHashJoinExecNode sliding_hash_join = 2400;
1170+
SlidingNestedLoopJoinExecNode sliding_nested_loop_join = 2500;
11691171
}
11701172
}
11711173

@@ -1434,6 +1436,11 @@ enum PartitionMode {
14341436
AUTO = 2;
14351437
}
14361438

1439+
enum StreamPartitionMode {
1440+
SINGLE_PARTITION = 0;
1441+
PARTITIONED_EXEC = 1;
1442+
}
1443+
14371444
message HashJoinExecNode {
14381445
PhysicalPlanNode left = 1;
14391446
PhysicalPlanNode right = 2;
@@ -1444,11 +1451,6 @@ message HashJoinExecNode {
14441451
JoinFilter filter = 8;
14451452
}
14461453

1447-
enum StreamPartitionMode {
1448-
SINGLE_PARTITION = 0;
1449-
PARTITIONED_EXEC = 1;
1450-
}
1451-
14521454
message SymmetricHashJoinExecNode {
14531455
PhysicalPlanNode left = 1;
14541456
PhysicalPlanNode right = 2;
@@ -1463,6 +1465,27 @@ message InterleaveExecNode {
14631465
repeated PhysicalPlanNode inputs = 1;
14641466
}
14651467

1468+
message SlidingHashJoinExecNode {
1469+
PhysicalPlanNode left = 1;
1470+
PhysicalPlanNode right = 2;
1471+
repeated JoinOn on = 3;
1472+
JoinType join_type = 4;
1473+
StreamPartitionMode partition_mode = 6;
1474+
bool null_equals_null = 7;
1475+
JoinFilter filter = 8;
1476+
repeated PhysicalExprNode left_sort_exprs = 9;
1477+
repeated PhysicalExprNode right_sort_exprs = 10;
1478+
}
1479+
1480+
message SlidingNestedLoopJoinExecNode {
1481+
PhysicalPlanNode left = 1;
1482+
PhysicalPlanNode right = 2;
1483+
JoinType join_type = 3;
1484+
JoinFilter filter = 4;
1485+
repeated PhysicalExprNode left_sort_exprs = 5;
1486+
repeated PhysicalExprNode right_sort_exprs = 6;
1487+
}
1488+
14661489
message UnionExecNode {
14671490
repeated PhysicalPlanNode inputs = 1;
14681491
}

0 commit comments

Comments
 (0)