presto-tpch/src/main/java/io/prestosql/plugin/tpch/util/Optionals.java/Optionals/combine
class Optionals:    public static <T> Optional<T> combine(Optional<T> left, Optional<T> right, BinaryOperator<T> combiner)
    {
        if (left.isPresent() && right.isPresent()) {
            return Optional.of(combiner.apply(left.get(), right.get()));
        }
        else if (left.isPresent()) {
            return left;
        }
        else {
            return right;
        }
    }