abhishekrb19 commented on code in PR #19198:
URL: https://github.com/apache/druid/pull/19198#discussion_r2977030707


##########
processing/src/main/java/org/apache/druid/segment/StringDimensionIndexer.java:
##########
@@ -84,9 +85,13 @@ public StringDimensionIndexer(
     this.maxStringLength = maxStringLength;
   }
 
+  /**
+   * Truncates the value to the first {@link #maxStringLength} characters if 
configured, otherwise returns it as-is.
+   */
+  @Nullable
   private String truncateIfNeeded(String value)

Review Comment:
   Intellij is flagging this for me:
   ```suggestion
     private String truncateIfNeeded(@Nullable String value)
   ```



##########
processing/src/main/java/org/apache/druid/segment/DefaultColumnFormatConfig.java:
##########


Review Comment:
   Since 0 is supported, the error message should be "non-negative integer" or 
"Value must be >= 0" 



##########
processing/src/main/java/org/apache/druid/data/input/impl/StringDimensionSchema.java:
##########
@@ -34,12 +34,23 @@ public class StringDimensionSchema extends DimensionSchema
 {
   private static final boolean DEFAULT_CREATE_BITMAP_INDEX = true;
 
-  public static int getDefaultMaxStringLength()
+  @Nullable
+  public static Integer getDefaultMaxStringLength()
   {
     return BuiltInTypesModule.getMaxStringLength();
   }
 
-  private final int maxStringLength;
+  @Nullable
+  private static Integer validateMaxStringLength(@Nullable Integer 
maxStringLength)
+  {
+    if (maxStringLength != null && maxStringLength < 0) {
+      throw new IllegalArgumentException("maxStringLength must be >= 0, got " 
+ maxStringLength);

Review Comment:
   Please use `DruidException` and 
[include](https://github.com/apache/druid/blob/master/processing/src/main/java/org/apache/druid/error/DruidException.java#L32)
 column name in the error message.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to