This is an automated email from the ASF dual-hosted git repository.

gwphua pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/master by this push:
     new ccfcb1c56a0 Improve error message when serialized bytes exceeds 
smoosher's max (#18845)
ccfcb1c56a0 is described below

commit ccfcb1c56a00367de31d6e31cb5eae9f1ffa5987
Author: Abhishek Radhakrishnan <[email protected]>
AuthorDate: Wed Dec 31 01:35:25 2025 -0500

    Improve error message when serialized bytes exceeds smoosher's max (#18845)
    
    - Include column name and a suggestion on how to remediate
---
 .../java/util/common/io/smoosh/FileSmoosher.java      |  9 ++++++++-
 .../util/common/io/smoosh/SmooshedFileMapperTest.java | 19 +++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git 
a/processing/src/main/java/org/apache/druid/java/util/common/io/smoosh/FileSmoosher.java
 
b/processing/src/main/java/org/apache/druid/java/util/common/io/smoosh/FileSmoosher.java
index 1d1bed181df..2c8d8bec13d 100644
--- 
a/processing/src/main/java/org/apache/druid/java/util/common/io/smoosh/FileSmoosher.java
+++ 
b/processing/src/main/java/org/apache/druid/java/util/common/io/smoosh/FileSmoosher.java
@@ -23,6 +23,7 @@ import com.google.common.base.Joiner;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.primitives.Ints;
+import org.apache.druid.error.DruidException;
 import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.common.IAE;
 import org.apache.druid.java.util.common.IOE;
@@ -158,7 +159,13 @@ public class FileSmoosher implements SegmentFileBuilder
   public SmooshedWriter addWithSmooshedWriter(final String name, final long 
size) throws IOException
   {
     if (size > maxChunkSize) {
-      throw new IAE("Asked to add buffers[%,d] larger than configured 
max[%,d]", size, maxChunkSize);
+      throw DruidException.forPersona(DruidException.Persona.ADMIN)
+                          .ofCategory(DruidException.Category.RUNTIME_FAILURE)
+                          .build("Serialized buffer size[%,d] for column[%s] 
exceeds the maximum[%,d]. "
+                                  + "Consider adjusting the tuningConfig - for 
example, reduce maxRowsPerSegment, "
+                                  + "or partition your data further.",
+                                  size, name, maxChunkSize
+                          );
     }
 
     // If current writer is in use then create a new SmooshedWriter which
diff --git 
a/processing/src/test/java/org/apache/druid/java/util/common/io/smoosh/SmooshedFileMapperTest.java
 
b/processing/src/test/java/org/apache/druid/java/util/common/io/smoosh/SmooshedFileMapperTest.java
index 11660f6d3b5..3d8c01d1af9 100644
--- 
a/processing/src/test/java/org/apache/druid/java/util/common/io/smoosh/SmooshedFileMapperTest.java
+++ 
b/processing/src/test/java/org/apache/druid/java/util/common/io/smoosh/SmooshedFileMapperTest.java
@@ -22,10 +22,13 @@ package org.apache.druid.java.util.common.io.smoosh;
 import com.google.common.io.Files;
 import com.google.common.primitives.Ints;
 import junit.framework.Assert;
+import org.apache.druid.error.DruidException;
+import org.apache.druid.error.DruidExceptionMatcher;
 import org.apache.druid.java.util.common.BufferUtils;
 import org.apache.druid.java.util.common.ISE;
 import org.apache.druid.java.util.common.StringUtils;
 import org.apache.druid.segment.file.SegmentFileChannel;
+import org.hamcrest.MatcherAssert;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
@@ -80,6 +83,22 @@ public class SmooshedFileMapperTest
     validateOutput(baseDir);
   }
 
+  @Test
+  public void testColumnSerializedSizeExceedsMaximum() throws Exception
+  {
+    File baseDir = folder.newFolder("base");
+    try (FileSmoosher smoosher = new FileSmoosher(baseDir, 5)) {
+      MatcherAssert.assertThat(
+          org.junit.Assert.assertThrows(
+              DruidException.class,
+              () -> smoosher.addWithChannel("foo", 10)
+          ),
+          new DruidExceptionMatcher(DruidException.Persona.ADMIN, 
DruidException.Category.RUNTIME_FAILURE, "general")
+              .expectMessageContains("Serialized buffer size[10] for 
column[foo] exceeds the maximum[5].")
+      );
+    }
+  }
+
   @Test(expected = ISE.class)
   public void testExceptionForUnClosedFiles() throws Exception
   {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to