Merge pull request #2392 from metamx/fix2391

Allow ExtractionDimFilter value to be null
This commit is contained in:
Fangjin Yang 2016-02-03 17:47:14 -08:00
commit da77591129
2 changed files with 3 additions and 1 deletions

View File

@ -82,7 +82,7 @@ public class ExtractionDimFilter implements DimFilter
public byte[] getCacheKey()
{
byte[] dimensionBytes = StringUtils.toUtf8(dimension);
byte[] valueBytes = StringUtils.toUtf8(value);
byte[] valueBytes = value == null ? new byte[0] : StringUtils.toUtf8(value);
byte[] extractionFnBytes = extractionFn.getCacheKey();
return ByteBuffer.allocate(3 + dimensionBytes.length + valueBytes.length + extractionFnBytes.length)
.put(DimFilterCacheHelper.EXTRACTION_CACHE_ID)

View File

@ -55,5 +55,7 @@ public class ExtractionDimFilterTest
);
Assert.assertFalse(Arrays.equals(extractionDimFilter2.getCacheKey(), extractionDimFilter3.getCacheKey()));
Assert.assertNotNull(new ExtractionDimFilter("foo", null, new RegexDimExtractionFn("xx", null, null), null));
}
}