Search in sources :

Example 6 with RegexDimExtractionFn

use of io.druid.query.extraction.RegexDimExtractionFn in project druid by druid-io.

the class SelectorDimFilterTest method testToString.

@Test
public void testToString() {
    SelectorDimFilter selectorDimFilter = new SelectorDimFilter("abc", "d", null);
    RegexDimExtractionFn regexFn = new RegexDimExtractionFn(".*", false, null);
    SelectorDimFilter selectorDimFilter2 = new SelectorDimFilter("abc", "d", regexFn);
    Assert.assertEquals("abc = d", selectorDimFilter.toString());
    Assert.assertEquals("regex(.*)(abc) = d", selectorDimFilter2.toString());
}
Also used : RegexDimExtractionFn(io.druid.query.extraction.RegexDimExtractionFn) Test(org.junit.Test)

Example 7 with RegexDimExtractionFn

use of io.druid.query.extraction.RegexDimExtractionFn in project druid by druid-io.

the class SelectorDimFilterTest method testHashCode.

@Test
public void testHashCode() {
    SelectorDimFilter selectorDimFilter = new SelectorDimFilter("abc", "d", null);
    RegexDimExtractionFn regexFn = new RegexDimExtractionFn(".*", false, null);
    SelectorDimFilter selectorDimFilter2 = new SelectorDimFilter("abc", "d", regexFn);
    Assert.assertNotEquals(selectorDimFilter.hashCode(), selectorDimFilter2.hashCode());
}
Also used : RegexDimExtractionFn(io.druid.query.extraction.RegexDimExtractionFn) Test(org.junit.Test)

Example 8 with RegexDimExtractionFn

use of io.druid.query.extraction.RegexDimExtractionFn in project druid by druid-io.

the class ExtractionDimFilterTest method testGetCacheKey.

@Test
public void testGetCacheKey() {
    ExtractionDimFilter extractionDimFilter = new ExtractionDimFilter("abc", "d", IdentityExtractionFn.getInstance(), null);
    ExtractionDimFilter extractionDimFilter2 = new ExtractionDimFilter("ab", "cd", IdentityExtractionFn.getInstance(), null);
    Assert.assertFalse(Arrays.equals(extractionDimFilter.getCacheKey(), extractionDimFilter2.getCacheKey()));
    ExtractionDimFilter extractionDimFilter3 = new ExtractionDimFilter("ab", "cd", new RegexDimExtractionFn("xx", null, null), null);
    Assert.assertFalse(Arrays.equals(extractionDimFilter2.getCacheKey(), extractionDimFilter3.getCacheKey()));
    Assert.assertNotNull(new ExtractionDimFilter("foo", null, new RegexDimExtractionFn("xx", null, null), null).getCacheKey());
}
Also used : RegexDimExtractionFn(io.druid.query.extraction.RegexDimExtractionFn) Test(org.junit.Test)

Example 9 with RegexDimExtractionFn

use of io.druid.query.extraction.RegexDimExtractionFn in project druid by druid-io.

the class IntervalDimFilterTest method testEquals.

@Test
public void testEquals() {
    RegexDimExtractionFn regexFn = new RegexDimExtractionFn(".*", false, null);
    DimFilter intervalFilter1 = new IntervalDimFilter(Column.TIME_COLUMN_NAME, Arrays.asList(Interval.parse("1970-01-01T00:00:00.001Z/1970-01-01T00:00:00.004Z"), Interval.parse("1975-01-01T00:00:00.001Z/1980-01-01T00:00:00.004Z")), null);
    DimFilter intervalFilter2 = new IntervalDimFilter(Column.TIME_COLUMN_NAME, Arrays.asList(Interval.parse("1970-01-01T00:00:00.001Z/1970-01-01T00:00:00.004Z"), Interval.parse("1975-01-01T00:00:00.001Z/1980-01-01T00:00:00.004Z")), regexFn);
    DimFilter intervalFilter3 = new IntervalDimFilter(Column.TIME_COLUMN_NAME, Arrays.asList(Interval.parse("1970-01-01T00:00:00.001Z/1970-01-01T00:00:00.004Z"), Interval.parse("1977-01-01T00:00:00.001Z/1980-01-01T00:00:00.004Z")), null);
    Assert.assertNotEquals(intervalFilter1, intervalFilter2);
    Assert.assertNotEquals(intervalFilter1, intervalFilter3);
    DimFilter intervalFilter4 = new IntervalDimFilter(Column.TIME_COLUMN_NAME, Arrays.asList(Interval.parse("1970-01-01T00:00:00.001Z/1970-01-01T00:00:00.004Z"), Interval.parse("1975-01-01T00:00:00.001Z/1977-01-01T00:00:00.004Z"), Interval.parse("1976-01-01T00:00:00.001Z/1980-01-01T00:00:00.004Z")), null);
    Assert.assertEquals(intervalFilter1, intervalFilter4);
    DimFilter intervalFilter5 = new IntervalDimFilter("__thyme", Arrays.asList(Interval.parse("1970-01-01T00:00:00.001Z/1970-01-01T00:00:00.004Z"), Interval.parse("1975-01-01T00:00:00.001Z/1980-01-01T00:00:00.004Z")), null);
    Assert.assertNotEquals(intervalFilter1, intervalFilter5);
}
Also used : RegexDimExtractionFn(io.druid.query.extraction.RegexDimExtractionFn) Test(org.junit.Test)

Example 10 with RegexDimExtractionFn

use of io.druid.query.extraction.RegexDimExtractionFn in project druid by druid-io.

the class RegexDimFilterTest method testGetCacheKey.

@Test
public void testGetCacheKey() {
    RegexDimFilter regexDimFilter = new RegexDimFilter("dim", "reg", null);
    RegexDimFilter regexDimFilter2 = new RegexDimFilter("di", "mreg", null);
    Assert.assertFalse(Arrays.equals(regexDimFilter.getCacheKey(), regexDimFilter2.getCacheKey()));
    RegexDimExtractionFn regexFn = new RegexDimExtractionFn(".*", false, null);
    RegexDimFilter regexDimFilter3 = new RegexDimFilter("dim", "reg", regexFn);
    Assert.assertFalse(Arrays.equals(regexDimFilter.getCacheKey(), regexDimFilter3.getCacheKey()));
}
Also used : RegexDimExtractionFn(io.druid.query.extraction.RegexDimExtractionFn) Test(org.junit.Test)

Aggregations

RegexDimExtractionFn (io.druid.query.extraction.RegexDimExtractionFn)35 Test (org.junit.Test)35 ExtractionDimensionSpec (io.druid.query.dimension.ExtractionDimensionSpec)11 Result (io.druid.query.Result)7 PostAggregator (io.druid.query.aggregation.PostAggregator)7 HyperUniqueFinalizingPostAggregator (io.druid.query.aggregation.hyperloglog.HyperUniqueFinalizingPostAggregator)7 DateTime (org.joda.time.DateTime)7 ExtractionFn (io.druid.query.extraction.ExtractionFn)6 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4 DefaultObjectMapper (io.druid.jackson.DefaultObjectMapper)4 DefaultDimensionSpec (io.druid.query.dimension.DefaultDimensionSpec)4 RegexFilteredDimensionSpec (io.druid.query.dimension.RegexFilteredDimensionSpec)4 IdentityExtractionFn (io.druid.query.extraction.IdentityExtractionFn)4 Row (io.druid.data.input.Row)3 LongSumAggregatorFactory (io.druid.query.aggregation.LongSumAggregatorFactory)3 DimensionSpec (io.druid.query.dimension.DimensionSpec)3 ListFilteredDimensionSpec (io.druid.query.dimension.ListFilteredDimensionSpec)3 SearchQuerySpec (io.druid.query.search.search.SearchQuerySpec)3 CascadeExtractionFn (io.druid.query.extraction.CascadeExtractionFn)2 DimExtractionFn (io.druid.query.extraction.DimExtractionFn)2