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

   ### Search before asking
   
   - [x] I searched the issues and found no report for this case.
   
   ### Paimon version
   
   `master` at `6a9e258775f0e43431c48b8fb22469b1b02c8ca5` (2.2-SNAPSHOT).
   
   ### Compute Engine
   
   PyPaimon, Python 3.11.2 and PyArrow 22.0.0, with a local filesystem catalog 
and a Parquet primary-key table.
   
   ### Minimal reproduce step
   
   ```python
   from pypaimon import Schema
   from pypaimon.schema.data_types import AtomicType, DataField
   
   bigint = AtomicType('BIGINT')
   schema = Schema(
       [DataField(0, 'id', bigint), DataField(1, 'value', bigint)],
       primary_keys=['id'],
   )
   print([field.type.nullable for field in schema.fields])
   # [False, False]; expected [False, True]
   ```
   
   Create a table with this schema and write `(id=1, value=None)`. The catalog 
persists `value` as `NOT NULL`, and the Python writer rejects the row with 
`Cannot write null to non-null column(value)`.
   
   ### What doesn't meet your expectations?
   
   Making `id` non-nullable should not change the declared nullability of 
`value` just because both fields reuse the same `DataType` instance. With 
`primary-key.nullable=true`, the same mutation can also make a declared `NOT 
NULL` payload nullable.
   
   ### Anything else?
   
   Copy the key field and its type when changing its nullability, as Java's 
`Schema` does, instead of modifying the shared type.
   
   ### 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