{"record":{"id":"9b8d5f4b212dce77","repo":"apache/druid","slug":"compression-value-d-is-greater-than-the-max-all","errorCode":null,"errorMessage":"Compression value [%d] is greater than the max allowed compression value [%d]. Setting it to max allowed value","messagePattern":"Compression value \\[(.+?)\\] is greater than the max allowed compression value \\[(.+?)\\]\\. Setting it to max allowed value","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"extensions-contrib/tdigestsketch/src/main/java/org/apache/druid/query/aggregation/tdigestsketch/TDigestSketchAggregatorFactory.java","lineNumber":109,"sourceCode":"      @JacksonInject final TDigestConfig tDigestConfig\n  )\n  {\n    this(name, fieldName, compression, AggregatorUtil.TDIGEST_BUILD_SKETCH_CACHE_TYPE_ID, tDigestConfig);\n  }\n\n  TDigestSketchAggregatorFactory(\n      final String name,\n      final String fieldName,\n      @Nullable final Integer compression,\n      final byte cacheTypeId,\n      final TDigestConfig tDigestConfig\n  )\n  {\n    this.name = Objects.requireNonNull(name, \"Must have a valid, non-null aggregator name\");\n    this.fieldName = Objects.requireNonNull(fieldName, \"Parameter fieldName must be specified\");\n    this.tDigestConfig = tDigestConfig;\n    if (tDigestConfig.getMaxCompression() != null && compression != null && compression > tDigestConfig.getMaxCompression()) {\n      log.warn(\n          \"Compression value [%d] is greater than the max allowed compression value [%d]. Setting it to max allowed value\",\n          compression,\n          tDigestConfig.getMaxCompression()\n      );\n      this.compression = tDigestConfig.getMaxCompression();\n    } else {\n      this.compression = Configs.valueOrDefault(compression, DEFAULT_COMPRESSION);\n    }\n    this.cacheTypeId = cacheTypeId;\n  }\n\n\n  @Override\n  public byte[] getCacheKey()\n  {\n    return new CacheKeyBuilder(\n        cacheTypeId\n    ).appendString(fieldName).appendInt(compression).build();","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-contrib/tdigestsketch/src/main/java/org/apache/druid/query/aggregation/tdigestsketch/TDigestSketchAggregatorFactory.java#L91-L127","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\n{\"type\":\"TDigestSketch\",\"fieldName\":\"latency\",\"compression\":1000} // max is 500\n// after\n{\"type\":\"TDigestSketch\",\"fieldName\":\"latency\",\"compression\":500}","handlingStrategy":"validation","validationCode":"Integer max = tdigestConfig.getMaxCompression();\nif (compression != null && max != null && compression > max) {\n    compression = max; // clamp before constructing the factory\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["druid","aggregation","configuration","tdigest"],"backgroundTag":"value-out-of-range","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}