mirror of https://github.com/apache/druid.git
Merge pull request #2392 from metamx/fix2391
Allow ExtractionDimFilter value to be null
This commit is contained in:
commit
da77591129
|
@ -82,7 +82,7 @@ public class ExtractionDimFilter implements DimFilter
|
||||||
public byte[] getCacheKey()
|
public byte[] getCacheKey()
|
||||||
{
|
{
|
||||||
byte[] dimensionBytes = StringUtils.toUtf8(dimension);
|
byte[] dimensionBytes = StringUtils.toUtf8(dimension);
|
||||||
byte[] valueBytes = StringUtils.toUtf8(value);
|
byte[] valueBytes = value == null ? new byte[0] : StringUtils.toUtf8(value);
|
||||||
byte[] extractionFnBytes = extractionFn.getCacheKey();
|
byte[] extractionFnBytes = extractionFn.getCacheKey();
|
||||||
return ByteBuffer.allocate(3 + dimensionBytes.length + valueBytes.length + extractionFnBytes.length)
|
return ByteBuffer.allocate(3 + dimensionBytes.length + valueBytes.length + extractionFnBytes.length)
|
||||||
.put(DimFilterCacheHelper.EXTRACTION_CACHE_ID)
|
.put(DimFilterCacheHelper.EXTRACTION_CACHE_ID)
|
||||||
|
|
|
@ -55,5 +55,7 @@ public class ExtractionDimFilterTest
|
||||||
);
|
);
|
||||||
|
|
||||||
Assert.assertFalse(Arrays.equals(extractionDimFilter2.getCacheKey(), extractionDimFilter3.getCacheKey()));
|
Assert.assertFalse(Arrays.equals(extractionDimFilter2.getCacheKey(), extractionDimFilter3.getCacheKey()));
|
||||||
|
|
||||||
|
Assert.assertNotNull(new ExtractionDimFilter("foo", null, new RegexDimExtractionFn("xx", null, null), null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue