Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ public Filter toFilter()
@Override
public RangeSet<String> getDimensionRangeSet(String dimension)
{
if (!Objects.equals(getColumn(), dimension)) {
return null;
}

RangeSet<String> retSet = TreeRangeSet.create();
// Nulls are less than empty String in segments
retSet.add(Range.lessThan(""));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Range;
import com.google.common.collect.TreeRangeSet;
import nl.jqno.equalsverifier.EqualsVerifier;
import org.apache.druid.common.config.NullHandling;
import org.apache.druid.jackson.DefaultObjectMapper;
Expand All @@ -41,6 +43,7 @@

import java.io.Closeable;
import java.util.Arrays;
import java.util.Collections;

@RunWith(Enclosed.class)
public class NullFilterTests
Expand Down Expand Up @@ -310,6 +313,19 @@ public void testArrays()

public static class NullFilterNonParameterizedTest
{
@Test
public void testGetDimensionRangeSet()
{
final NullFilter filter = new NullFilter("x", null);

Assert.assertEquals(
TreeRangeSet.create(Collections.singleton(Range.lessThan(""))),
filter.getDimensionRangeSet("x")
);

Assert.assertNull(filter.getDimensionRangeSet("y"));
}

@Test
public void testSerde() throws JsonProcessingException
{
Expand Down