Source:
<code>protected Optional<PlanNodeStatsEstimate> visitComparisonExpression(ComparisonExpression node, Void context) { ComparisonExpression.Operator operator = node.getOperator(); Expression left = node.getLeft(); Expression right = node.getRight(); checkArgument(!(left instanceof Literal && right instanceof Literal), "Literal-to-literal not supported here, should be eliminated earlier"); if (!(left instanceof SymbolReference) && right instanceof SymbolReference) { return process(new ComparisonExpression(operator.flip(), right, left)); } if (left instanceof Literal && !(right instanceof Literal)) { return process(new ComparisonExpression(operator.flip(), right, left)); } SymbolStatsEstimate leftStats = getExpressionStats(left); if (leftStats.isUnknown()) { return Optional.empty(); } Optional<Symbol> leftSymbol = Symbol.optionalFrom(left); if (right instanceof Literal) { OptionalDouble literal = doubleValueFromLiteral(getType(left), (Literal) right); PlanNodeStatsEstimate estimate = estimateExpressionToLiteralComparison(input, leftStats, leftSymbol, literal, operator); if (estimate.isOutputRowCountUnknown()) { return Optional.empty(); } return Optional.of(estimate); } SymbolStatsEstimate rightStats = getExpressionStats(right); if (rightStats.isUnknown()) { return Optional.empty(); } if (left instanceof SymbolReference && left.equals(right)) { return process(new IsNotNullPredicate(left)); } if (rightStats.isSingleValue()) { OptionalDouble value = isNaN(rightStats.getLowValue()) ? OptionalDouble.empty() : OptionalDouble.of(rightStats.getLowValue()); PlanNodeStatsEstimate estimate = estimateExpressionToLiteralComparison(input, leftStats, leftSymbol, value, operator); if (estimate.isOutputRowCountUnknown()) { return Optional.empty(); } return Optional.of(estimate); } PlanNodeStatsEstimate estimate = estimateExpressionToExpressionComparison(input, leftStats, leftSymbol, rightStats, Symbol.optionalFrom(right), operator); if (estimate.isOutputRowCountUnknown()) { return Optional.empty(); } <START> return Optional.of(estimate); <END> }</code><technical_language>I if inlined version is</technical_language>

Target:
protected PlanNodeStatsEstimate visitComparisonExpression(ComparisonExpression node, Void context) { ComparisonExpression.Operator operator = node.getOperator(); Expression left = node.getLeft(); Expression right = node.getRight(); checkArgument(!(left instanceof Literal && right instanceof Literal), "Literal-to-literal not supported here, should be eliminated earlier"); if (!(left instanceof SymbolReference) && right instanceof SymbolReference) { return process(new ComparisonExpression(operator.flip(), right, left)); } if (left instanceof Literal && !(right instanceof Literal)) { return process(new ComparisonExpression(operator.flip(), right, left)); } if (left instanceof SymbolReference && left.equals(right)) { return process(new IsNotNullPredicate(left)); } SymbolStatsEstimate leftStats = getExpressionStats(left); Optional<Symbol> leftSymbol = left instanceof SymbolReference ? Optional.of(Symbol.from(left)) : Optional.empty(); if (right instanceof Literal) { OptionalDouble literal = doubleValueFromLiteral(getType(left), (Literal) right); return estimateExpressionToLiteralComparison(input, leftStats, leftSymbol, literal, operator); } SymbolStatsEstimate rightStats = getExpressionStats(right); if (rightStats.isSingleValue()) { OptionalDouble value = isNaN(rightStats.getLowValue()) ? OptionalDouble.empty() : OptionalDouble.of(rightStats.getLowValue()); return estimateExpressionToLiteralComparison(input, leftStats, leftSymbol, value, operator); } Optional<Symbol> rightSymbol = right instanceof SymbolReference ? Optional.of(Symbol.from(right)) : Optional.empty(); return estimateExpressionToExpressionComparison(input, leftStats, leftSymbol, rightStats, rightSymbol, operator); }