Skip to content

fix: handle byte[] complex types from realtime segments in MSQ scans (#18340) - #20091

Open
zhang-arvin wants to merge 1 commit into
apache:masterfrom
zhang-arvin:fix/issue-18340-msq-complex-types
Open

fix: handle byte[] complex types from realtime segments in MSQ scans (#18340)#20091
zhang-arvin wants to merge 1 commit into
apache:masterfrom
zhang-arvin:fix/issue-18340-msq-complex-types

Conversation

@zhang-arvin

Copy link
Copy Markdown

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.

@FrankChen021 FrankChen021 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reviewed the code for correctness, edge cases, concurrency, and integration risks; no issues found.

Reviewed 2 of 2 changed files.


This is an automated review by Codex GPT-5.6-Luna(max)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Realtime scans from MSQ cannot reliably read complex types

2 participants