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:01 UTC

[I] [Bug] Avro throws ClassCastException when writing MULTISET with a non-string element type [paimon]

thswlsqls opened a new issue, #9064:
URL: https://github.com/apache/paimon/issues/9064

   **Search before asking**
   - [x] I searched in the [issues](https://github.com/apache/paimon/issues) and found nothing similar.
   
   **Paimon version**
   master @ a5e87ebf6 (2.1-SNAPSHOT)
   
   **Compute Engine**
   Engine-agnostic — the failure is in `paimon-format` (avro).
   
   **Minimal reproduce step**
   Create a table with a `MULTISET<INT>` column and `'file.format' = 'avro'`, then insert one row.
   
   DDL succeeds: `AvroFileFormat.validateDataFields()` only calls `AvroSchemaConverter.convertToSchema()`, which handles `MULTISET` and `MAP` in one branch and emits the array-of-record encoding for a non-string key.
   
   The first write then fails:
   
   ```
   java.lang.ClassCastException: MultisetType cannot be cast to ArrayType
     at org.apache.paimon.format.avro.AvroSchemaVisitor.visit(AvroSchemaVisitor.java:61)
     at org.apache.paimon.format.avro.FieldWriterFactory.visitUnion(FieldWriterFactory.java:107)
   ```
   
   `AvroSchemaVisitor.visit()` handles only `MapType` and `VectorType` in its `ARRAY` branch and casts anything else to `ArrayType`, which is `final`. Reads go through the same method.
   
   **What doesn't meet your expectations?**
   Expected: the row is written and read back, as ORC and Parquet already do for the same schema.
   Actual: every write of a `MULTISET` with a non-string element type throws.
   
   **Anything else?**
   `MULTISET<STRING>` is unaffected — it uses the native avro map encoding.
   
   **Are you willing to submit a PR?**
   - [x] I'm willing to submit a PR!
   
   


-- 
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.apache.org

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


Re: [I] [Bug] Avro throws ClassCastException when writing MULTISET with a non-string element type [paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi closed issue #9064: [Bug] Avro throws ClassCastException when writing MULTISET with a non-string element type
URL: https://github.com/apache/paimon/issues/9064


-- 
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