-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Avoid sorting values in InDimFilter if possible #9800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
76aa704
18991e1
0346843
4d6e7a5
e97ce94
2e40df1
d1f3d17
e4e4590
07cbeff
5e67d9c
ef6938d
9ce40f9
f033ccb
fe69355
ef4f62f
e2dc504
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.apache.druid.query.filter; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonCreator; | ||
| import com.google.common.collect.ImmutableRangeSet; | ||
| import com.google.common.collect.RangeSet; | ||
| import org.apache.druid.query.cache.CacheKeyBuilder; | ||
| import org.apache.druid.segment.filter.FalseFilter; | ||
|
|
||
| import javax.annotation.Nullable; | ||
| import java.util.Collections; | ||
| import java.util.Set; | ||
|
|
||
| public class FalseDimFilter implements DimFilter | ||
| { | ||
| private static final FalseDimFilter INSTANCE = new FalseDimFilter(); | ||
| private static final byte[] CACHE_KEY = new CacheKeyBuilder(DimFilterUtils.FALSE_CACHE_ID).build(); | ||
|
|
||
| @JsonCreator | ||
| public static FalseDimFilter instance() | ||
| { | ||
| return INSTANCE; | ||
| } | ||
|
|
||
| private FalseDimFilter() | ||
| { | ||
| } | ||
|
|
||
| @Override | ||
| public DimFilter optimize() | ||
| { | ||
| return this; | ||
| } | ||
|
|
||
| @Override | ||
| public Filter toFilter() | ||
| { | ||
| return FalseFilter.instance(); | ||
| } | ||
|
|
||
| @Nullable | ||
| @Override | ||
| public RangeSet<String> getDimensionRangeSet(String dimension) | ||
| { | ||
| return ImmutableRangeSet.of(); | ||
| } | ||
|
|
||
| @Override | ||
| public Set<String> getRequiredColumns() | ||
| { | ||
| return Collections.emptySet(); | ||
| } | ||
|
|
||
| @Override | ||
| public byte[] getCacheKey() | ||
| { | ||
| return CACHE_KEY; | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() | ||
| { | ||
| return DimFilterUtils.FALSE_CACHE_ID; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) | ||
| { | ||
| return o != null && o.getClass() == this.getClass(); | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. EqualsVerifierTest for this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
|
|
||
| @Override | ||
| public String toString() | ||
| { | ||
| return "FALSE"; | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AndDimFilterTest is missing branch coverage for this and line 88
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this code is hit by other tests in druid-processing, but I'm not sure which ones
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of this and
OrDimFilterare prevalent in unit tests so I believe they are being tested somewhere (I didn't change the logic of the lines you mentioned). But I can add some more tests.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.