You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "thswlsqls (via GitHub)" <gi...@apache.org> on 2026/08/06 06:58:33 UTC

[PR] [avro] Fix ClassCastException when writing MULTISET with non-string element type [paimon]

thswlsqls opened a new pull request, #9066:
URL: https://github.com/apache/paimon/pull/9066

   
   ### Purpose
   
   fix #9064
   
   - `AvroSchemaConverter` handles `MULTISET` and `MAP` in one branch, so a non-string element gets the array-of-record encoding.
   - `AvroSchemaVisitor.visit()` recognized only `MapType` in its `ARRAY` branch and cast everything else to the `final` class `ArrayType`, so any `MULTISET` with a non-string element threw `ClassCastException` on write and read, even though `validateDataFields` passed. ORC and Parquet already accept that schema.
   - Reuse the converter's `extractKeyTypeToAvroMap`/`extractValueTypeToAvroMap` there, keeping schema creation and visiting on one source. The converter is untouched, so the written encoding is unchanged.
   - Correct the avro `MAP`/`MULTISET` rows in `fileformat.md`: the `MAP` row says the key must be a string type, but `FormatReadWriteTest`'s `nonStrKeyMap = MAP(INT, ...)` already passes on avro.
   
   ### Tests
   
   - Added `AvroFormatReadWriteTest#testMultisetWithNonStringElement` (round trip; throws without the fix) and `#testMultisetWithStringElement` (regression guard).
   - `mvn -pl paimon-format -DfailIfNoTests=false clean install` — 531 tests passed, 0 failures. No existing test used `MULTISET`.
   
   
   


-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [avro] Fix ClassCastException when writing MULTISET with non-string element type [paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on PR #9066:
URL: https://github.com/apache/paimon/pull/9066#issuecomment-5205870543

   +1


-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [avro] Fix ClassCastException when writing MULTISET with non-string element type [paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #9066:
URL: https://github.com/apache/paimon/pull/9066


-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org