Skip to content

Commit

Permalink
Implement
Browse files Browse the repository at this point in the history
  • Loading branch information
desmondcheongzx committed Nov 20, 2024
1 parent 066cde1 commit 4d6d6d6
Show file tree
Hide file tree
Showing 36 changed files with 928 additions and 170 deletions.
8 changes: 4 additions & 4 deletions src/daft-catalog/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,14 @@ mod tests {
])
.unwrap(),
);
LogicalPlan::Source(Source {
output_schema: schema.clone(),
source_info: Arc::new(SourceInfo::PlaceHolder(PlaceHolderInfo {
LogicalPlan::Source(Source::new(
schema.clone(),
Arc::new(SourceInfo::PlaceHolder(PlaceHolderInfo {
source_schema: schema,
clustering_spec: Arc::new(ClusteringSpec::unknown()),
source_id: 0,
})),
})
))
.arced()
}

Expand Down
17 changes: 11 additions & 6 deletions src/daft-local-execution/src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,18 +319,23 @@ pub fn physical_plan_to_pipeline(
null_equals_null,
join_type,
schema,
..
}) => {
let left_schema = left.schema();
let right_schema = right.schema();
let left_size = left.get_stats().approx_stats.upper_bound_bytes;
let right_size = right.get_stats().approx_stats.upper_bound_bytes;

// Determine the build and probe sides based on the join type
// Currently it is a naive determination, in the future we should leverage the cardinality of the tables
// to determine the build and probe sides
// Determine the build and probe sides based on the join type and cardinalities.
let build_on_left = match join_type {
JoinType::Inner => true,
JoinType::Right => true,
JoinType::Outer => true,
JoinType::Inner => left_size <= right_size,
JoinType::Outer => left_size <= right_size,
// TODO(desmond): We might potentially want to flip the probe table side for
// left/right outer joins if one side is significantly larger. Needs tuning.
// For left outer joins, we build on right so we can stream the left side.
JoinType::Left => false,
// For right outer joins, we build on left so we can stream the right side.
JoinType::Right => true,
JoinType::Anti | JoinType::Semi => false,
};
let (build_on, probe_on, build_child, probe_child) = match build_on_left {
Expand Down
Loading

0 comments on commit 4d6d6d6

Please sign in to comment.