use of org.apache.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 org.apache.druid.query.extraction.RegexDimExtractionFn in project druid by druid-io.
the class JavaScriptDimFilterTest method testGetCacheKey.
@Test
public void testGetCacheKey() {
JavaScriptDimFilter javaScriptDimFilter = new JavaScriptDimFilter("dim", FN1, null, JavaScriptConfig.getEnabledInstance());
JavaScriptDimFilter javaScriptDimFilter2 = new JavaScriptDimFilter("di", FN2, null, JavaScriptConfig.getEnabledInstance());
Assert.assertFalse(Arrays.equals(javaScriptDimFilter.getCacheKey(), javaScriptDimFilter2.getCacheKey()));
RegexDimExtractionFn regexFn = new RegexDimExtractionFn(".*", false, null);
JavaScriptDimFilter javaScriptDimFilter3 = new JavaScriptDimFilter("dim", FN1, regexFn, JavaScriptConfig.getEnabledInstance());
Assert.assertFalse(Arrays.equals(javaScriptDimFilter.getCacheKey(), javaScriptDimFilter3.getCacheKey()));
}
use of org.apache.druid.query.extraction.RegexDimExtractionFn in project druid by druid-io.
the class JavaScriptDimFilterTest method testEquals.
@Test
public void testEquals() {
JavaScriptDimFilter javaScriptDimFilter = new JavaScriptDimFilter("dim", FN1, null, JavaScriptConfig.getEnabledInstance());
JavaScriptDimFilter javaScriptDimFilter2 = new JavaScriptDimFilter("di", FN2, null, JavaScriptConfig.getEnabledInstance());
JavaScriptDimFilter javaScriptDimFilter3 = new JavaScriptDimFilter("di", FN2, null, JavaScriptConfig.getEnabledInstance());
Assert.assertNotEquals(javaScriptDimFilter, javaScriptDimFilter2);
Assert.assertEquals(javaScriptDimFilter2, javaScriptDimFilter3);
RegexDimExtractionFn regexFn = new RegexDimExtractionFn(".*", false, null);
JavaScriptDimFilter javaScriptDimFilter4 = new JavaScriptDimFilter("dim", FN1, regexFn, JavaScriptConfig.getEnabledInstance());
JavaScriptDimFilter javaScriptDimFilter5 = new JavaScriptDimFilter("dim", FN1, regexFn, JavaScriptConfig.getEnabledInstance());
Assert.assertNotEquals(javaScriptDimFilter, javaScriptDimFilter3);
Assert.assertEquals(javaScriptDimFilter4, javaScriptDimFilter5);
}
use of org.apache.druid.query.extraction.RegexDimExtractionFn in project druid by druid-io.
the class IntervalDimFilterTest method testHashCode.
@Test
public void testHashCode() {
RegexDimExtractionFn regexFn = new RegexDimExtractionFn(".*", false, null);
DimFilter intervalFilter1 = new IntervalDimFilter(ColumnHolder.TIME_COLUMN_NAME, Arrays.asList(Intervals.of("1970-01-01T00:00:00.001Z/1970-01-01T00:00:00.004Z"), Intervals.of("1975-01-01T00:00:00.001Z/1980-01-01T00:00:00.004Z")), null);
DimFilter intervalFilter2 = new IntervalDimFilter(ColumnHolder.TIME_COLUMN_NAME, Arrays.asList(Intervals.of("1970-01-01T00:00:00.001Z/1970-01-01T00:00:00.004Z"), Intervals.of("1975-01-01T00:00:00.001Z/1980-01-01T00:00:00.004Z")), regexFn);
DimFilter intervalFilter3 = new IntervalDimFilter(ColumnHolder.TIME_COLUMN_NAME, Arrays.asList(Intervals.of("1970-01-01T00:00:00.001Z/1970-01-01T00:00:00.004Z"), Intervals.of("1977-01-01T00:00:00.001Z/1980-01-01T00:00:00.004Z")), null);
Assert.assertNotEquals(intervalFilter1.hashCode(), intervalFilter2.hashCode());
Assert.assertNotEquals(intervalFilter1.hashCode(), intervalFilter3.hashCode());
DimFilter intervalFilter4 = new IntervalDimFilter(ColumnHolder.TIME_COLUMN_NAME, Arrays.asList(Intervals.of("1970-01-01T00:00:00.001Z/1970-01-01T00:00:00.004Z"), Intervals.of("1975-01-01T00:00:00.001Z/1977-01-01T00:00:00.004Z"), Intervals.of("1976-01-01T00:00:00.001Z/1980-01-01T00:00:00.004Z")), null);
Assert.assertEquals(intervalFilter1.hashCode(), intervalFilter4.hashCode());
DimFilter intervalFilter5 = new IntervalDimFilter("__thyme", Arrays.asList(Intervals.of("1970-01-01T00:00:00.001Z/1970-01-01T00:00:00.004Z"), Intervals.of("1975-01-01T00:00:00.001Z/1980-01-01T00:00:00.004Z")), null);
Assert.assertNotEquals(intervalFilter1.hashCode(), intervalFilter5.hashCode());
}
use of org.apache.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(ColumnHolder.TIME_COLUMN_NAME, Arrays.asList(Intervals.of("1970-01-01T00:00:00.001Z/1970-01-01T00:00:00.004Z"), Intervals.of("1975-01-01T00:00:00.001Z/1980-01-01T00:00:00.004Z")), null);
DimFilter intervalFilter2 = new IntervalDimFilter(ColumnHolder.TIME_COLUMN_NAME, Arrays.asList(Intervals.of("1970-01-01T00:00:00.001Z/1970-01-01T00:00:00.004Z"), Intervals.of("1975-01-01T00:00:00.001Z/1980-01-01T00:00:00.004Z")), regexFn);
DimFilter intervalFilter3 = new IntervalDimFilter(ColumnHolder.TIME_COLUMN_NAME, Arrays.asList(Intervals.of("1970-01-01T00:00:00.001Z/1970-01-01T00:00:00.004Z"), Intervals.of("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(ColumnHolder.TIME_COLUMN_NAME, Arrays.asList(Intervals.of("1970-01-01T00:00:00.001Z/1970-01-01T00:00:00.004Z"), Intervals.of("1975-01-01T00:00:00.001Z/1977-01-01T00:00:00.004Z"), Intervals.of("1976-01-01T00:00:00.001Z/1980-01-01T00:00:00.004Z")), null);
Assert.assertEquals(intervalFilter1, intervalFilter4);
DimFilter intervalFilter5 = new IntervalDimFilter("__thyme", Arrays.asList(Intervals.of("1970-01-01T00:00:00.001Z/1970-01-01T00:00:00.004Z"), Intervals.of("1975-01-01T00:00:00.001Z/1980-01-01T00:00:00.004Z")), null);
Assert.assertNotEquals(intervalFilter1, intervalFilter5);
}
Aggregations