datafusion_physical_plan/joins/mod.rs
1// Licensed to the Apache Software Foundation (ASF) under one
2// or more contributor license agreements. See the NOTICE file
3// distributed with this work for additional information
4// regarding copyright ownership. The ASF licenses this file
5// to you under the Apache License, Version 2.0 (the
6// "License"); you may not use this file except in compliance
7// with the License. You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing,
12// software distributed under the License is distributed on an
13// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14// KIND, either express or implied. See the License for the
15// specific language governing permissions and limitations
16// under the License.
17
18//! DataFusion Join implementations
19
20use arrow::array::BooleanBufferBuilder;
21pub use cross_join::CrossJoinExec;
22pub use hash_join::HashJoinExec;
23pub use nested_loop_join::NestedLoopJoinExec;
24use parking_lot::Mutex;
25// Note: SortMergeJoin is not used in plans yet
26pub use sort_merge_join::SortMergeJoinExec;
27pub use symmetric_hash_join::SymmetricHashJoinExec;
28mod cross_join;
29mod hash_join;
30mod nested_loop_join;
31mod sort_merge_join;
32mod stream_join_utils;
33mod symmetric_hash_join;
34pub mod utils;
35
36mod join_filter;
37#[cfg(test)]
38pub mod test_utils;
39
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41/// Hash join Partitioning mode
42pub enum PartitionMode {
43 /// Left/right children are partitioned using the left and right keys
44 Partitioned,
45 /// Left side will collected into one partition
46 CollectLeft,
47 /// DataFusion optimizer decides which PartitionMode
48 /// mode(Partitioned/CollectLeft) is optimal based on statistics. It will
49 /// also consider swapping the left and right inputs for the Join
50 Auto,
51}
52
53/// Partitioning mode to use for symmetric hash join
54#[derive(Hash, Clone, Copy, Debug, PartialEq, Eq)]
55pub enum StreamJoinPartitionMode {
56 /// Left/right children are partitioned using the left and right keys
57 Partitioned,
58 /// Both sides will collected into one partition
59 SinglePartition,
60}
61
62/// Shared bitmap for visited left-side indices
63type SharedBitmapBuilder = Mutex<BooleanBufferBuilder>;