csun5285 opened a new pull request, #64273:
URL: https://github.com/apache/doris/pull/64273
…
A heterogeneous array such as {"a": ["1", 2, 1.1]} (string + int + double)
stored in a VARIANT sparse column was reconstructed with a wrong element type:
DataTypeArraySerDe::deserialize_binary_to_field set the array element type to
the last non-null element's type instead of the least common (JSONB-aware)
supertype. For the example it yielded array<double> and dropped the string
element, which then crashed during AGGREGATE merge re-insertion with:
[E-7412]Field::get type mismatch: requested DOUBLE, actual STRING
Fix:
- Compute the array element type as get_least_supertype_jsonb over all
element types (so mixed string + numeric resolves to JSONB), and mark the field
as needing conversion when the elements are heterogeneous.
- Propagate FieldInfo::need_convert through FieldWithDataType so the
conversion flag survives the sparse read path (FieldInfo -> FieldWithDataType
-> FieldInfo); otherwise the field is inserted into the column without
converting elements to the common type.
The crash is only reachable when a variant subcolumn budget forces the path
to be materialized (e.g. fuzzy default_variant_max_subcolumns_count=1); the
original test aborted earlier on a separate non-deterministic whitespace
difference in the variant-to-string projection, so the AGGREGATE crash was
latent.
Also stabilize the regression case: project the variant via cast(v as json),
whose canonical compact output is independent of whether the subcolumn is
materialized as a typed array or kept as sparse JSONB, removing the flaky
whitespace mismatch.
### What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR should
merge into -->
--
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]