private static Optional<ValComparatorFactory> getComparatorFactory(final Type type1, final Type type2) {
        if (type1 == null || type2 == null) {
            return Optional.empty();
        } else {
            return Optional.ofNullable(COMPARATOR_NESTED_MAP.get(type1))
                    .map(subMap -> subMap.get(type2));
        }
    }
type1 and type2 can be in any order
stroom-query/stroom-query-language/src/main/java/stroom/query/language/functions/ValComparators.java