Skip to content

Commit cacdb8c

Browse files
committed
Add fast path for mixed-reference predicates in authoritative mode
Ensure that mixed-reference predicates with only one join key lock in the desired behavior. The is_restrict_null_predicate(...) function returns false in both Auto and AuthoritativeOnly modes, thereby maintaining the fast path functionality in utils.rs even after applying the push_down_filter fix.
1 parent 61a02ad commit cacdb8c

2 files changed

Lines changed: 24 additions & 63 deletions

File tree

FIX_03.md

Lines changed: 0 additions & 63 deletions
This file was deleted.

datafusion/optimizer/src/utils.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,4 +463,28 @@ mod tests {
463463

464464
Ok(())
465465
}
466+
467+
#[test]
468+
fn mixed_reference_predicate_remains_fast_pathed_in_authoritative_mode(
469+
) -> Result<()> {
470+
let predicate = binary_expr(col("a"), Operator::Gt, col("b"));
471+
let column_a = Column::from_name("a");
472+
473+
set_null_restriction_eval_mode_for_test(NullRestrictionEvalMode::Auto);
474+
let auto_result =
475+
is_restrict_null_predicate(predicate.clone(), std::iter::once(&column_a))?;
476+
477+
set_null_restriction_eval_mode_for_test(
478+
NullRestrictionEvalMode::AuthoritativeOnly,
479+
);
480+
let authoritative_only_result =
481+
is_restrict_null_predicate(predicate.clone(), std::iter::once(&column_a))?;
482+
483+
set_null_restriction_eval_mode_for_test(NullRestrictionEvalMode::Auto);
484+
485+
assert!(!auto_result, "{predicate}");
486+
assert!(!authoritative_only_result, "{predicate}");
487+
488+
Ok(())
489+
}
466490
}

0 commit comments

Comments
 (0)