zhang-arvin opened a new pull request, #20091: URL: https://github.com/apache/druid/pull/20091
### Description When MSQ scans realtime segments containing complex types, `ColumnValueSelector.getObject()` returns the already-serialized `byte[]` form rather than the deserialized object. `ComplexMetricSerde.toBytes()` calls `ObjectStrategy.toBytes(val)` which expects the deserialized object type `T`, causing a `ClassCastException` when the value is actually `byte[]`. This fix adds a new `objectToBytes(Object val)` default method to `ObjectStrategy` that checks if the value is already a `byte[]` and returns it directly, otherwise delegates to the existing `toBytes(T val)` method. `ComplexMetricSerde.toBytes()` is updated to use `objectToBytes()` instead of `toBytes()`. ### Changes - **ObjectStrategy.java**: Added `objectToBytes(Object val)` default method that handles `byte[]` input directly - **ComplexMetricSerde.java**: Changed `toBytes(val)` to `objectToBytes(val)` in the serde Fixes #18340. -- 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]
