JingsongLi commented on code in PR #10208:
URL: https://github.com/apache/paimon/pull/10208#discussion_r4178165866


##########
paimon-core/src/main/java/org/apache/paimon/table/sink/TableWriteImpl.java:
##########
@@ -264,6 +268,10 @@ private void checkNullability(InternalRow row, RowKind 
rowKind) {
     }
 
     private InternalRow wrapDefaultValue(InternalRow row) {
+        if (defaultValueRowOutdated) {
+            defaultValueRow = DefaultValueRow.create(writeType);

Review Comment:
   [P2] Preserve ROW defaults when rebuilding for a nested partial write
   
   The Java `BatchTableWrite.withWriteType(...).write(...)` path also wraps 
rows (as exercised by `NestedSubfieldDataEvolutionTableTest`). For a table with 
one column `nest ROW<a INT,b STRING> DEFAULT {42,z}`, enabling row 
tracking/data evolution/nested fields and writing with 
`table.rowType().projectByPaths(["nest.a"])` retains the full `{42,z}` default 
in the projected field metadata. This new `create(writeType)` consequently 
throws `Row field count mismatch. Expected: 1, Actual: 2`, even for an 
explicitly nonnull `GenericRow.of(GenericRow.of(100))`. I reproduced this with 
a real FileSystemCatalog: commit `(10,x)`, then update only `nest.a`; this head 
fails before writing, while disabling only `defaultValueRowOutdated` restores 
the previous behavior and commits/reads `(100,x)`. Please project/translate the 
cached defaults consistently with the nested write type (or otherwise retain 
support for this wrapping path), and add a Java partial-write regression test; 
bypassing the wrapper 
 in Spark/Flink partial writers does not cover this API.



-- 
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