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

   ### Search before asking
   
   - [x] I searched in the [issues](https://github.com/apache/paimon/issues) 
and found nothing similar.
   
   
   ### Paimon version
   
   2.0
   
   ### Compute Engine
   
   flink1.18
   
   ### Minimal reproduce step
   
   1. Create a nullable MAP type in PyPaimon:
   
     from pypaimon.schema.data_types import AtomicType, MapType
   
     map_type = MapType(
         nullable=True,
         key_type=AtomicType("STRING", nullable=False),
         value_type=AtomicType("BLOB"),
     )
   
     print(map_type.to_dict())
   
     2. PyPaimon writes the following type definition into the table's 
schema-*.json file:
   
     {
       "type": "MAP<STRING NOT NULL, BLOB>",
       "key": "STRING NOT NULL",
       "value": "BLOB",
       "nullable": true
     }
   
     3. Load the same table from Java, or deserialize the generated type 
definition directly:
   
     String json =
             "{\"type\":\"MAP<STRING NOT NULL, BLOB>\","
                     + "\"key\":\"STRING NOT NULL\","
                     + "\"value\":\"BLOB\","
                     + "\"nullable\":true}";
   
     DataType type = JsonSerdeUtil.fromJson(json, DataType.class);
   
     assertThat(type.isNullable()).isTrue();
   
     The assertion fails on the current master branch.
   
   ### What doesn't meet your expectations?
   
    Java should preserve the outer MAP's nullable=true value written by 
PyPaimon. Instead, DataTypeJsonParser searches the complete type string for NOT 
NULL and mistakes the key's nullability for the outer MAP's nullability.
   
     The MAP is therefore loaded as NOT NULL, and writing a null MAP value from 
Java fails with:
   
     Cannot write null to non-null column
   
   ### Anything else?
   
   _No response_
   
   ### 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