public static double betweenSelectivity(KllFloatsSketch kll, float leftValue, float rightValue) {
    // column >= leftValue AND column <= rightValue
    if (rightValue < leftValue) {
      return 0;
    }
    if (Double.compare(leftValue, rightValue) == 0) {
      throw new IllegalArgumentException(
          "Selectivity for BETWEEN leftValue AND rightValue when the two values coincide is not supported, found: "
          + "leftValue = " + leftValue + " and rightValue = " + rightValue);
    }
    return rangedSelectivity(kll, Math.nextDown(leftValue), Math.nextUp(rightValue));
  }
Returns the selectivity of a predicate "column BETWEEN leftValue AND rightValue" in the range [0, 1]
@param kll the KLL sketch for the involved column
@param leftValue the LHS literal in the BETWEEN statement
@param rightValue the RHS literal in the BETWEEN statement
@return the selectivity of a predicate "column BETWEEN leftValue AND rightValue" in the range [0, 1]
@throws IllegalArgumentException if leftValue is equal to rightValue
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/FilterSelectivityEstimator.java