apache/druid · warning
Compression value [ ] is greater than the max allowed…
Error message
Compression value [%d] is greater than the max allowed compression value [%d]. Setting it to max allowed value
What it means
TDigestSketchAggregatorFactory warns and clamps when the requested t-digest compression exceeds the maximum allowed by TDigestSketchConfig.maxCompression. The constructor does not throw; it silently sets compression to the max allowed value. This protects memory usage since compression drives sketch size.
Solutions
- Lower the compression parameter in the aggregator spec to be <= maxCompression
- Or raise druid.query.tDigest.maxCompression in the runtime config if the larger sketch is intentional and memory allows
- Check the warning in logs to confirm which value was clamped; recompute expected memory footprint
- Align compression values between ingestion and query specs to keep results consistent
Example fix
// before
{"type":"TDigestSketch","fieldName":"latency","compression":1000} // max is 500
// after
{"type":"TDigestSketch","fieldName":"latency","compression":500} Defensive patterns
Strategy: validation
Validate before calling
Integer max = tdigestConfig.getMaxCompression();
if (compression != null && max != null && compression > max) {
compression = max; // clamp before constructing the factory
} Prevention
- Keep compression <= druid.query.tDigest.maxCompression
- Use consistent compression between ingestion and query specs
- Check logs after deployment for the clamping warning
- Document the environment's maxCompression in your spec templates
When it happens
Trigger: Creating a TDigestSketch aggregator/post-aggregator with a compression parameter larger than the value configured in druid.query.tDigest.maxCompression (or in the TDigestSketchModule config).
Common situations: A query or ingestion spec written for an environment with no maxCompression cap is reused where a cap was added; operator lowers maxCompression globally; typos producing huge compression values like 10000.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- maxStringBytes must be greater than 0
- Aggregation [ ] does not support column [ ] of type [ ]…
- Aggregator[ ] cannot vectorize
- AggregatorFactoryNotMergeableException
- AggregatorFactoryNotMergeableException
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/9b8d5f4b212dce77.
Report an issue: GitHub.
Appendix: source
Thrown at extensions-contrib/tdigestsketch/src/main/java/org/apache/druid/query/aggregation/tdigestsketch/TDigestSketchAggregatorFactory.java:109
@JacksonInject final TDigestConfig tDigestConfig
)
{
this(name, fieldName, compression, AggregatorUtil.TDIGEST_BUILD_SKETCH_CACHE_TYPE_ID, tDigestConfig);
}
TDigestSketchAggregatorFactory(
final String name,
final String fieldName,
@Nullable final Integer compression,
final byte cacheTypeId,
final TDigestConfig tDigestConfig
)
{
this.name = Objects.requireNonNull(name, "Must have a valid, non-null aggregator name");
this.fieldName = Objects.requireNonNull(fieldName, "Parameter fieldName must be specified");
this.tDigestConfig = tDigestConfig;
if (tDigestConfig.getMaxCompression() != null && compression != null && compression > tDigestConfig.getMaxCompression()) {
log.warn(
"Compression value [%d] is greater than the max allowed compression value [%d]. Setting it to max allowed value",
compression,
tDigestConfig.getMaxCompression()
);
this.compression = tDigestConfig.getMaxCompression();
} else {
this.compression = Configs.valueOrDefault(compression, DEFAULT_COMPRESSION);
}
this.cacheTypeId = cacheTypeId;
}
@Override
public byte[] getCacheKey()
{
return new CacheKeyBuilder(
cacheTypeId
).appendString(fieldName).appendInt(compression).build();View on GitHub (pinned to 9b90983fd2)