presto-main/src/main/java/io/prestosql/sql/planner/EqualityInference.java/EqualityInference/isInferenceCandidate
class EqualityInference:    public static boolean isInferenceCandidate(Metadata metadata, Expression expression)
    {
        if (expression instanceof ComparisonExpression &&
                isDeterministic(expression, metadata) &&
                !mayReturnNullOnNonNullInput(expression)) {
            ComparisonExpression comparison = (ComparisonExpression) expression;
            if (comparison.getOperator() == ComparisonExpression.Operator.EQUAL) {
                // We should only consider equalities that have distinct left and right components
                return !comparison.getLeft().equals(comparison.getRight());
            }
        }
        return false;
    }