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

   **Search before asking**
   - [x] I searched in the [issues](https://github.com/apache/paimon/issues) 
and found nothing similar.
   
   **Paimon version**
   master @ 345526e26 (2.0-SNAPSHOT)
   
   **Compute Engine**
   Engine-agnostic (`paimon-arrow`)
   
   **Minimal reproduce step**
   Write a null array element into a column declared `ARRAY<INT> NOT NULL`:
   
   ```java
   RowType rowType = RowType.of(DataTypes.ARRAY(DataTypes.INT()).notNull());
   try (ArrowFormatWriter writer = new ArrowFormatWriter(rowType, 16, true)) {
       writer.write(GenericRow.of(new GenericArray(new Object[] {1, null, 3})));
   }
   ```
   
   This throws `IllegalArgumentException: Field 'element' expected not null but 
found null value`.
   
   **What doesn't meet your expectations?**
   The array is NOT NULL but its element type is nullable, so a null element is 
valid and should be written.
   
   `ArrowFieldWriterFactoryVisitor.visit(ArrayType/VectorType/MapType/RowType)` 
passes the parent field's `isNullable` down to the element/key/value/child 
writers instead of the nested type's own `isNullable()`, and 
`ArrowFieldWriter.write(int, DataGetters, int)` rejects nulls when that flag is 
false. The reverse case (`ARRAY<INT NOT NULL>` under a nullable parent) 
silently writes nulls, contradicting the non-nullable child field that 
`ArrowUtils.toArrowField()` declares.
   
   **Anything else?**
   Follow-up of #5538, which applied the same rule to `ArrowFormatWriter` only 
and left the sub writer creation sites unchanged.
   
   **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