Copilot commented on code in PR #17685:
URL: https://github.com/apache/pinot/pull/17685#discussion_r2850309024
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/recordtransformer/SanitizationTransformer.java:
##########
@@ -132,7 +132,7 @@ private Pair<String, Boolean> sanitizeValue(String
columnName, String value,
case TRIM_LENGTH:
return Pair.of(sanitizedValue, true);
case SUBSTITUTE_DEFAULT_VALUE:
- return
Pair.of(FieldSpec.getStringValue(sanitizedColumnInfo.getDefaultNullValue()),
true);
+ return Pair.of((String) sanitizedColumnInfo.getDefaultNullValue(),
true);
Review Comment:
`sanitizeValue()` can be invoked for BYTES columns when the incoming
`GenericRow` stores the BYTES value as a `String` (e.g. hex), because the
dispatch in `transform()` is based on the runtime value type, not the schema
type. In that scenario, `sanitizedColumnInfo.getDefaultNullValue()` will be a
`byte[]`, and casting it to `String` will throw `ClassCastException` when using
`SUBSTITUTE_DEFAULT_VALUE`. Using
`FieldSpec.getStringValue(sanitizedColumnInfo.getDefaultNullValue())` (or
handling BYTES explicitly) would keep this path safe for both `String` and
`byte[]` defaults.
```suggestion
return
Pair.of(FieldSpec.getStringValue(sanitizedColumnInfo.getDefaultNullValue()),
true);
```
--
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]