presto-iceberg/src/main/java/io/prestosql/plugin/iceberg/ExpressionConverter.java/ExpressionConverter/toIcebergExpression
class ExpressionConverter:    private static Expression toIcebergExpression(String columnName, Type type, Domain domain, ConnectorSession session)
    {
        if (domain.isAll()) {
            return alwaysTrue();
        }
        if (domain.getValues().isNone()) {
            return domain.isNullAllowed() ? isNull(columnName) : alwaysFalse();
        }

        if (domain.getValues().isAll()) {
            return domain.isNullAllowed() ? alwaysTrue() : not(isNull(columnName));
        }

        ValueSet domainValues = domain.getValues();
        Expression expression = null;
        if (domain.isNullAllowed()) {
            expression = isNull(columnName);
        }

        if (domainValues instanceof EquatableValueSet) {
            expression = firstNonNull(expression, alwaysFalse());
            EquatableValueSet valueSet = (EquatableValueSet) domainValues;
            if (valueSet.isWhiteList()) {
                // if whitelist is true than this is a case of "in", otherwise this is a case of "not in".
                return or(expression, equal(columnName, valueSet.getValues()));
            }
            return or(expression, notEqual(columnName, valueSet.getValues()));
        }

        if (domainValues instanceof SortedRangeSet) {
            List<Range> orderedRanges = ((SortedRangeSet) domainValues).getOrderedRanges();
            expression = firstNonNull(expression, alwaysFalse());

            for (Range range : orderedRanges) {
                Marker low = range.getLow();
                Marker high = range.getHigh();
                Marker.Bound lowBound = low.getBound();
                Marker.Bound highBound = high.getBound();

                // case col <> 'val' is represented as (col < 'val' or col > 'val')
                if (lowBound == EXACTLY && highBound == EXACTLY) {
                    // case ==
                    if (getValue(type, low, session).equals(getValue(type, high, session))) {
                        expression = or(expression, equal(columnName, getValue(type, low, session)));
                    }
                    else { // case between
                        Expression between = and(
                                greaterThanOrEqual(columnName, getValue(type, low, session)),
                                lessThanOrEqual(columnName, getValue(type, high, session)));
                        expression = or(expression, between);
                    }
                }
                else {
                    if (lowBound == EXACTLY && low.getValueBlock().isPresent()) {
                        // case >=
                        expression = or(expression, greaterThanOrEqual(columnName, getValue(type, low, session)));
                    }
                    else if (lowBound == ABOVE && low.getValueBlock().isPresent()) {
                        // case >
                        expression = or(expression, greaterThan(columnName, getValue(type, low, session)));
                    }

                    if (highBound == EXACTLY && high.getValueBlock().isPresent()) {
                        // case <=
                        if (low.getValueBlock().isPresent()) {
                            expression = and(expression, lessThanOrEqual(columnName, getValue(type, high, session)));
                        }
                        else {
                            expression = or(expression, lessThanOrEqual(columnName, getValue(type, high, session)));
                        }
                    }
                    else if (highBound == BELOW && high.getValueBlock().isPresent()) {
                        // case <
                        if (low.getValueBlock().isPresent()) {
                            expression = and(expression, lessThan(columnName, getValue(type, high, session)));
                        }
                        else {
                            expression = or(expression, lessThan(columnName, getValue(type, high, session)));
                        }
                    }
                }
            }
            return expression;
        }

        throw new VerifyException("Did not expect a domain value set other than SortedRangeSet and EquatableValueSet but got " + domainValues.getClass().getSimpleName());
    }