MCPcopy Create free account
hub / github.com/apache/datafusion / cardinality_ratio

Function cardinality_ratio

datafusion/expr-common/src/interval_arithmetic.rs:1722–1729  ·  view source on GitHub ↗

This function computes the selectivity of an operation by computing the cardinality ratio of the given input/output intervals. If this can not be calculated for some reason, it returns `1.0` meaning fully selective (no filtering).

(initial_interval: &Interval, final_interval: &Interval)

Source from the content-addressed store, hash-verified

1720/// calculated for some reason, it returns `1.0` meaning fully selective (no
1721/// filtering).
1722pub fn cardinality_ratio(initial_interval: &Interval, final_interval: &Interval) -> f64 {
1723 match (final_interval.cardinality(), initial_interval.cardinality()) {
1724 (Some(final_interval), Some(initial_interval)) => {
1725 (final_interval as f64) / (initial_interval as f64)
1726 }
1727 _ => 1.0,
1728 }
1729}
1730
1731/// Cast scalar value to the given data type using an arrow kernel.
1732fn cast_scalar_value(

Callers 1

calculate_selectivityFunction · 0.85

Calls 1

cardinalityMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…