presto-resource-group-managers/src/main/java/io/prestosql/plugin/resourcegroups/SelectorResourceEstimate.java/SelectorResourceEstimate/match
class SelectorResourceEstimate:    boolean match(ResourceEstimates resourceEstimates)
    {
        if (executionTime.isPresent()) {
            Optional<Duration> executionTimeEstimate = resourceEstimates.getExecutionTime()
                    .map(value -> new Duration(value.toMillis(), MILLISECONDS));
            if (!executionTimeEstimate.isPresent() || !executionTime.get().contains(executionTimeEstimate.get())) {
                return false;
            }
        }

        if (cpuTime.isPresent()) {
            Optional<Duration> cpuTimeEstimate = resourceEstimates.getCpuTime()
                    .map(value -> new Duration(value.toMillis(), MILLISECONDS));
            if (!cpuTimeEstimate.isPresent() || !cpuTime.get().contains(cpuTimeEstimate.get())) {
                return false;
            }
        }

        if (peakMemory.isPresent()) {
            Optional<DataSize> peakMemoryEstimate = resourceEstimates.getPeakMemoryBytes()
                    .map(value -> new DataSize(value, BYTE));
            if (!peakMemoryEstimate.isPresent() || !peakMemory.get().contains(peakMemoryEstimate.get())) {
                return false;
            }
        }

        return true;
    }