use of org.apache.druid.query.extraction.RegexDimExtractionFn in project druid by druid-io.
the class SelectorDimFilterTest method testGetCacheKey.
@Test
public void testGetCacheKey() {
SelectorDimFilter selectorDimFilter = new SelectorDimFilter("abc", "d", null);
SelectorDimFilter selectorDimFilter2 = new SelectorDimFilter("ab", "cd", null);
Assert.assertFalse(Arrays.equals(selectorDimFilter.getCacheKey(), selectorDimFilter2.getCacheKey()));
RegexDimExtractionFn regexFn = new RegexDimExtractionFn(".*", false, null);
SelectorDimFilter selectorDimFilter3 = new SelectorDimFilter("abc", "d", regexFn);
Assert.assertFalse(Arrays.equals(selectorDimFilter.getCacheKey(), selectorDimFilter3.getCacheKey()));
}
use of org.apache.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(/.*/, 1)(abc) = d", selectorDimFilter2.toString());
}
use of org.apache.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 org.apache.druid.query.extraction.RegexDimExtractionFn in project druid by druid-io.
the class InDimFilterTest method testGetCacheKeyDifferentKeysForListOfStringsAndSingleStringOfListsWithExtractFn.
@Test
public void testGetCacheKeyDifferentKeysForListOfStringsAndSingleStringOfListsWithExtractFn() {
RegexDimExtractionFn regexFn = new RegexDimExtractionFn(".*", false, null);
final InDimFilter inDimFilter1 = new InDimFilter("dimTest", Arrays.asList("good", "bad"), regexFn);
final InDimFilter inDimFilter2 = new InDimFilter("dimTest", Collections.singletonList("good,bad"), regexFn);
Assert.assertFalse(Arrays.equals(inDimFilter1.getCacheKey(), inDimFilter2.getCacheKey()));
}
use of org.apache.druid.query.extraction.RegexDimExtractionFn in project druid by druid-io.
the class JavaScriptDimFilterTest method testHashcode.
@Test
public void testHashcode() {
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.hashCode(), javaScriptDimFilter2.hashCode());
Assert.assertEquals(javaScriptDimFilter2.hashCode(), javaScriptDimFilter3.hashCode());
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.hashCode(), javaScriptDimFilter3.hashCode());
Assert.assertEquals(javaScriptDimFilter4.hashCode(), javaScriptDimFilter5.hashCode());
}
Aggregations