@Override
    public RexNode visitCall(final RexCall call) {
      switch (call.getKind()) {
        case AND:
          List<RexNode> newAndOperands = call.getOperands()
              .stream()
              .map(pred -> new Pair<>(pred, rankingAnd(pred)))
              .sorted(Comparator.comparing(Pair::getValue, Comparator.nullsLast(Double::compare)))
              .map(Pair::getKey)
              .collect(Collectors.toList());
          if (!call.getOperands().equals(newAndOperands)) {
            modified = true;
            return call.clone(call.getType(), newAndOperands);
          }
          break;
        case OR:
          List<RexNode> newOrOperands = call.getOperands()
              .stream()
              .map(pred -> new Pair<>(pred, rankingOr(pred)))
              .sorted(Comparator.comparing(Pair::getValue, Comparator.nullsLast(Double::compare)))
              .map(Pair::getKey)
              .collect(Collectors.toList());
          if (!call.getOperands().equals(newOrOperands)) {
            modified = true;
            return call.clone(call.getType(), newOrOperands);
          }
          break;
      }
      return call;
    }
If the expression is an AND/OR, it will sort predicates accordingly
to maximize performance.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveFilterSortPredicates.java