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

   ### Search before asking
   
   - [x] I searched the issues and found no matching report.
   
   ### Paimon version
   
   2.2-SNAPSHOT, master at `61f9981bc3b265da12446bf48eb0db441fb2da86`.
   
   ### Compute Engine
   
   Java file-format API, JDK 11.
   
   ### Minimal reproduce step
   
   Write an Avro file with a string-keyed map using `GenericDatumWriter`, then 
read it as Paimon `MAP<STRING, STRING>`:
   
   - A map with Avro value type `"string"` fails when the requested Paimon 
value type is nullable.
   - A map with Avro value type `["string", "null"]` also fails. The generic 
nullable-union reader already supports this ordering.
   
   The regression includes non-null and null values, empty maps, multiple 
records and a following string field. It also passes decoded maps directly to a 
Paimon Avro writer with a different value-nullability declaration, using only 
non-null values when the destination requires them, and reads the output with 
Avro's `GenericDatumReader`.
   
   ### What doesn't meet your expectations?
   
   These valid inputs should read and rewrite correctly. The optimized map 
reader assumes the requested nullability and null-first encoding match the 
file, which can cause malformed-length or EOF errors. Raw-byte rewriting with 
different value nullability produces an invalid destination encoding.
   
   ### Anything else?
   
   Use the existing schema-aware reader for noncanonical value layouts. Keep 
byte-backed maps for compatible layouts, and check their encoded value 
nullability before reusing bytes during a write.
   
   ### 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