milenkovicm commented on code in PR #1723:
URL:
https://github.com/apache/datafusion-ballista/pull/1723#discussion_r3341771648
##########
ballista/scheduler/src/state/aqe/optimizer_rule/propagate_empty.rs:
##########
@@ -85,12 +98,47 @@ impl PropagateEmptyExecRule {
&& is_empty_exec!(aggregation.input())
{
empty_exec!(aggregation)
- } else if let Some(hash_join) =
plan.as_any().downcast_ref::<HashJoinExec>()
- // TODO: - we need other joins, this one is used for testing
cancellation
- && hash_join.join_type == Inner
- && (is_empty_exec!(hash_join.left) ||
is_empty_exec!(hash_join.right))
+ } else if let Some(repartition) =
plan.as_any().downcast_ref::<RepartitionExec>()
+ && is_empty_exec!(repartition.input())
+ {
+ empty_exec!(repartition)
+ } else if let Some(coalesce_partition) =
+ plan.as_any().downcast_ref::<CoalescePartitionsExec>()
+ && is_empty_exec!(coalesce_partition.input())
{
- empty_exec!(hash_join)
+ empty_exec!(coalesce_partition)
+ } else if let Some(sort_preserving_merge) =
+ plan.as_any().downcast_ref::<SortPreservingMergeExec>()
+ && is_empty_exec!(sort_preserving_merge.input())
+ {
+ empty_exec!(sort_preserving_merge)
+ } else if let Some(join) = as_join(&plan) {
+ let left_empty = is_guaranteed_empty(join.left);
+ let right_empty = is_guaranteed_empty(join.right);
+
+ // Checking whether join would produce an empty result
+ let should_eliminate = match join.join_type {
+ JoinType::Inner => left_empty || right_empty,
+ JoinType::Full => left_empty && right_empty,
+ JoinType::Left
+ | JoinType::RightSemi
+ | JoinType::LeftAnti
+ | JoinType::LeftMark => left_empty,
Review Comment:
should we add left semi?
https://github.com/apache/datafusion/blob/7843ab385bdc90db02a80ccfd410eb74c1aeb0fb/datafusion/optimizer/src/propagate_empty_relation.rs#L143-L153
##########
ballista/scheduler/src/state/aqe/optimizer_rule/propagate_empty.rs:
##########
@@ -85,12 +98,47 @@ impl PropagateEmptyExecRule {
&& is_empty_exec!(aggregation.input())
{
empty_exec!(aggregation)
- } else if let Some(hash_join) =
plan.as_any().downcast_ref::<HashJoinExec>()
- // TODO: - we need other joins, this one is used for testing
cancellation
- && hash_join.join_type == Inner
- && (is_empty_exec!(hash_join.left) ||
is_empty_exec!(hash_join.right))
+ } else if let Some(repartition) =
plan.as_any().downcast_ref::<RepartitionExec>()
+ && is_empty_exec!(repartition.input())
+ {
+ empty_exec!(repartition)
+ } else if let Some(coalesce_partition) =
+ plan.as_any().downcast_ref::<CoalescePartitionsExec>()
+ && is_empty_exec!(coalesce_partition.input())
{
- empty_exec!(hash_join)
+ empty_exec!(coalesce_partition)
+ } else if let Some(sort_preserving_merge) =
+ plan.as_any().downcast_ref::<SortPreservingMergeExec>()
+ && is_empty_exec!(sort_preserving_merge.input())
+ {
+ empty_exec!(sort_preserving_merge)
+ } else if let Some(join) = as_join(&plan) {
+ let left_empty = is_guaranteed_empty(join.left);
+ let right_empty = is_guaranteed_empty(join.right);
+
+ // Checking whether join would produce an empty result
+ let should_eliminate = match join.join_type {
+ JoinType::Inner => left_empty || right_empty,
+ JoinType::Full => left_empty && right_empty,
+ JoinType::Left
+ | JoinType::RightSemi
+ | JoinType::LeftAnti
+ | JoinType::LeftMark => left_empty,
+ JoinType::Right
+ | JoinType::LeftSemi
+ | JoinType::RightAnti
+ | JoinType::RightMark => right_empty,
Review Comment:
should we add right semi?
https://github.com/apache/datafusion/blob/7843ab385bdc90db02a80ccfd410eb74c1aeb0fb/datafusion/optimizer/src/propagate_empty_relation.rs#L143-L153
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]