presto-main/src/main/java/io/prestosql/sql/planner/optimizations/TransformQuantifiedComparisonApplyToCorrelatedJoin.java/Rewriter/rewriteUsingBounds
class Rewriter:        public Expression rewriteUsingBounds(QuantifiedComparisonExpression quantifiedComparison, Symbol minValue, Symbol maxValue, Symbol countAllValue, Symbol countNonNullValue)
        {
            BooleanLiteral emptySetResult;
            Function<List<Expression>, Expression> quantifier;
            if (quantifiedComparison.getQuantifier() == ALL) {
                emptySetResult = TRUE_LITERAL;
                quantifier = expressions -> ExpressionUtils.combineConjuncts(metadata, expressions);
            }
            else {
                emptySetResult = FALSE_LITERAL;
                quantifier = expressions -> ExpressionUtils.combineDisjuncts(metadata, expressions);
            }
            Expression comparisonWithExtremeValue = getBoundComparisons(quantifiedComparison, minValue, maxValue);

            return new SimpleCaseExpression(
                    countAllValue.toSymbolReference(),
                    ImmutableList.of(new WhenClause(
                            new GenericLiteral("bigint", "0"),
                            emptySetResult)),
                    Optional.of(quantifier.apply(ImmutableList.of(
                            comparisonWithExtremeValue,
                            new SearchedCaseExpression(
                                    ImmutableList.of(
                                            new WhenClause(
                                                    new ComparisonExpression(NOT_EQUAL, countAllValue.toSymbolReference(), countNonNullValue.toSymbolReference()),
                                                    new Cast(new NullLiteral(), toSqlType(BOOLEAN)))),
                                    Optional.of(emptySetResult))))));
        }