check_short_circuit

Function check_short_circuit 

Source
fn check_short_circuit<'a>(
    lhs: &'a ColumnarValue,
    op: &Operator,
) -> ShortCircuitStrategy<'a>
Expand description

Checks if a logical operator (AND/OR) can short-circuit evaluation based on the left-hand side (lhs) result.

Short-circuiting occurs under these circumstances:

  • For AND:
    • if LHS is all false => short-circuit → return LHS
    • if LHS is all true => short-circuit → return RHS
    • if LHS is mixed and true_count/sum_count <= PRE_SELECTION_THRESHOLD -> pre-selection
  • For OR:
    • if LHS is all true => short-circuit → return LHS
    • if LHS is all false => short-circuit → return RHS

§Arguments

  • lhs - The left-hand side (lhs) columnar value (array or scalar)
  • lhs - The left-hand side (lhs) columnar value (array or scalar)
  • op - The logical operator (AND or OR)

§Implementation Notes

  1. Only works with Boolean-typed arguments (other types automatically return false)
  2. Handles both scalar values and array values
  3. For arrays, uses optimized bit counting techniques for boolean arrays