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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to