abhishekrb19 commented on code in PR #19198:
URL: https://github.com/apache/druid/pull/19198#discussion_r2976825983
##########
processing/src/main/java/org/apache/druid/data/input/impl/StringDimensionSchema.java:
##########
@@ -56,7 +58,7 @@ public StringDimensionSchema(
)
{
super(name, multiValueHandling, createBitmapIndex == null ?
DEFAULT_CREATE_BITMAP_INDEX : createBitmapIndex);
- this.maxStringLength = maxStringLength != null && maxStringLength > 0 ?
maxStringLength : getDefaultMaxStringLength();
+ this.maxStringLength = maxStringLength != null ? maxStringLength :
getDefaultMaxStringLength();
Review Comment:
It will be good to call the same validation function for the per-dimension
override `maxStringLength` as well. I think negative values will be accepted,
but cause undefined behavior when truncation is applied: `value.substring(0,
maxStringLength)`?
Consider adding a test in `StringDimensionSchemaTest` for this case
--
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]