This is an automated email from the ASF dual-hosted git repository. gian pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/druid.git
The following commit(s) were added to refs/heads/master by this push: new 8b8ca0d7fce DimFilterUtils: Exit filterShards early when filter is null. (#16774) 8b8ca0d7fce is described below commit 8b8ca0d7fce8721f292d662efe0d310694dad0aa Author: Gian Merlino <gianmerl...@gmail.com> AuthorDate: Mon Jul 22 21:17:11 2024 -0700 DimFilterUtils: Exit filterShards early when filter is null. (#16774) When the filter is null, there is no need to run the converter on all the input objects. --- .../main/java/org/apache/druid/query/filter/DimFilterUtils.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/processing/src/main/java/org/apache/druid/query/filter/DimFilterUtils.java b/processing/src/main/java/org/apache/druid/query/filter/DimFilterUtils.java index dad5cfd98b3..ff863f764b7 100644 --- a/processing/src/main/java/org/apache/druid/query/filter/DimFilterUtils.java +++ b/processing/src/main/java/org/apache/druid/query/filter/DimFilterUtils.java @@ -20,6 +20,7 @@ package org.apache.druid.query.filter; import com.google.common.base.Function; +import com.google.common.collect.ImmutableSet; import com.google.common.collect.RangeSet; import org.apache.druid.query.planning.DataSourceAnalysis; import org.apache.druid.timeline.partition.ShardSpec; @@ -116,13 +117,19 @@ public class DimFilterUtils final Map<String, Optional<RangeSet<String>>> dimensionRangeCache ) { + if (dimFilter == null) { + // ImmutableSet retains order from "input". + return ImmutableSet.copyOf(input); + } + + // LinkedHashSet retains order from "input". Set<T> retSet = new LinkedHashSet<>(); for (T obj : input) { ShardSpec shard = converter.apply(obj); boolean include = true; - if (dimFilter != null && shard != null) { + if (shard != null) { Map<String, RangeSet<String>> filterDomain = new HashMap<>(); List<String> dimensions = shard.getDomainDimensions(); for (String dimension : dimensions) { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org