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());
}
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());
}
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());
}
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);
}
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()));
}
Aggregations