{"record":{"id":"bad698374f1dc788","repo":"apache/druid","slug":"the-object-s-s-has-a-size-s-out-of-the-ran","errorCode":null,"errorMessage":"The object [%s, %s] has a size [%s] out of the range of the long type. The max long value will be used for its size instead.","messagePattern":"The object \\[(.+?), (.+?)\\] has a size \\[(.+?)\\] out of the range of the long type\\. The max long value will be used for its size instead\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"extensions-core/google-extensions/src/main/java/org/apache/druid/data/input/google/GoogleCloudStorageInputSource.java","lineNumber":160,"sourceCode":"        return getSize(storageObject);\n      }\n    }\n\n    return new SplitWidget();\n  }\n\n  private static long getSize(final GoogleStorageObjectMetadata object)\n  {\n    final Long sizeInLong = object.getSize();\n\n    if (sizeInLong == null) {\n      return Long.MAX_VALUE;\n    } else {\n      try {\n        return sizeInLong;\n      }\n      catch (ArithmeticException e) {\n        LOG.warn(\n            e,\n            \"The object [%s, %s] has a size [%s] out of the range of the long type. \"\n            + \"The max long value will be used for its size instead.\",\n            object.getBucket(),\n            object.getName(),\n            sizeInLong\n        );\n        return Long.MAX_VALUE;\n      }\n    }\n  }\n\n  @Override\n  public String toString()\n  {\n    return \"GoogleCloudStorageInputSource{\" +\n           \"uris=\" + getUris() +\n           \", prefixes=\" + getPrefixes() +","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/google-extensions/src/main/java/org/apache/druid/data/input/google/GoogleCloudStorageInputSource.java#L142-L178","documentation":"GoogleCloudStorageInputSource.getSize() logs this warning when a GCS object's reported size overflows a Java long when converted (Google may report sizes via BigInteger). Instead of propagating the overflow, the code catches ArithmeticException and falls back to Long.MAX_VALUE so partitioning logic still works. It is a degraded-accuracy warning, not a thrown error.","triggerScenarios":"Calling getSize() on an object whose size, when narrowed from BigInteger to long via longValueExact(), exceeds Long.MAX_VALUE (objects larger than ~9.2 exabytes)","commonSituations":"Effectively only possible with corrupted/hand-edited GCS metadata, mocked or proxied storage APIs reporting bogus sizes, or tests that stub objects with enormous sizes.","solutions":["Verify the object's actual metadata (size) via gsutil/gcloud storage ls -l; real GCS objects fit in a long, so a bogus size means bad metadata","If seen in tests, fix the mock/stub to return a realistic ContentEncoding/size value","If the warning is noise in a real deployment, update the Google Cloud Storage client library so sizes arrive as long directly and the ArithmeticException path disappears","No action needed functionally: code already uses Long.MAX_VALUE, and Druid treats it as an unpartitionable huge object"],"exampleFix":"// before\ntry {\n  return sizeInLong;\n}\ncatch (ArithmeticException e) { LOG.warn(...); return Long.MAX_VALUE; }\n// after\nfinal BigInteger size = object.getSize();\nif (size.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) > 0) {\n  LOG.warn(\"Object [%s/%s] size [%s] exceeds long range; using Long.MAX_VALUE\", object.getBucket(), object.getName(), size);\n  return Long.MAX_VALUE;\n}\nreturn size.longValue();","handlingStrategy":"validation","validationCode":"if (object.getSize() == null || object.getSize().compareTo(BigInteger.valueOf(Long.MAX_VALUE)) > 0) {\n  // treat as unbounded size\n}","typeGuard":"static boolean fitsInLong(BigInteger size) { return size != null && size.bitLength() <= 63; }","tryCatchPattern":null,"preventionTips":["Use a recent Google Cloud Storage client library where sizes are long-typed","Treat Long.MAX_VALUE sizes as 'unknown' in partitioning logic","Add tests that stub realistic object sizes"],"tags":["google-cloud-storage","long-overflow","input-source","druid"],"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-14T05:17:10.506Z"}