apache/druid · error · ExpressionProcessingException
failed to deserialize bloom filter
Error message
failed to deserialize bloom filter
What it means
When deserializing a base64-encoded BloomKFilter from bytes, an IOException causes the expression code to fail with 'failed to deserialize bloom filter'. This means the serialized filter bytes are corrupt, truncated, or not a valid BloomKFilter format.
Solutions
- Regenerate the base64 filter string with base64_to/from using the same Druid version that will consume it.
- Verify the base64 string is complete and has no whitespace or truncation.
- Confirm the filter was produced as a BloomKFilter (not another bloom implementation) via bloom_filter_expr.
Example fix
// before WHERE filter_bloom(x, 'SGVsbG8') -- truncated base64 // after WHERE filter_bloom(x, '<full base64 of bloom_filter_expr output>')
Defensive patterns
Strategy: try-catch
Validate before calling
// sanity-check base64 length before use
byte[] decoded = java.util.Base64.getDecoder().decode(b64.trim());
if (decoded.length < 16) throw new IllegalArgumentException("bloom filter base64 too short/corrupt"); Try / catch
try { filter_bloom(x, b64Filter); } catch (ExpressionProcessingException e) { /* regenerate filter via bloom_filter_expr and retry */ } Prevention
- Copy base64 strings without truncation or whitespace
- Generate and consume filters on compatible Druid versions
- Always produce filters with bloom_filter_expr, not hand-built bytes
When it happens
Trigger: Applying a literal bloom filter expression where the base64 string decodes to bytes that BloomFilterSerializersModule.bloomKFilterFromBytes cannot parse.
Common situations: Manually constructed/truncated base64 strings; filters serialized by an incompatible Druid version; whitespace or corruption introduced when copying the base64 string; passing a bloom_filter_expr output where a K-filter format is required.
Understand the failure class
Background: "failed to unmarshal" / json.Unmarshal errors: why parsing a response into a Go struct fails and how to fix it — this error's family across 23 libraries.
Related errors
- Failed to deserialize bloom filter
- Failed to deserialize to RoaringBitmap64Counter, input is…
- Input stream is null
- interrupted flushing elements from queue
- unknown event type [ ]
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/46f63f1fbe807356.
Report an issue: GitHub.
Appendix: source
Thrown at extensions-core/druid-bloom-filter/src/main/java/org/apache/druid/query/expressions/BloomFilterExpressions.java:328
}
@Nullable
@Override
public ExpressionType getOutputType(InputBindingInspector inspector)
{
return ExpressionType.LONG;
}
}
if (filterExpr.isLiteral() && filterExpr.getLiteralValue() instanceof String) {
final String serializedFilter = (String) filterExpr.getLiteralValue();
final byte[] decoded = StringUtils.decodeBase64String(serializedFilter);
BloomKFilter filter;
try {
filter = BloomFilterSerializersModule.bloomKFilterFromBytes(decoded);
}
catch (IOException ioe) {
throw processingFailed(ioe, "failed to deserialize bloom filter");
}
return new BloomExpr(filter, args);
} else {
return new DynamicBloomExpr(args);
}
}
}
}
View on GitHub (pinned to 9b90983fd2)