github-actions[bot] commented on code in PR #68874:
URL: https://github.com/apache/doris/pull/68874#discussion_r4237381450


##########
fe/fe-connector/fe-connector-paimon/src/main/java/org/apache/doris/connector/paimon/PaimonWriteBinding.java:
##########
@@ -78,26 +82,66 @@ static FileStoreTable configureTableForWrite(FileStoreTable 
table, boolean overw
         return table.copy(Collections.singletonMap(dynamicOverwriteKey, 
Boolean.FALSE.toString()));
     }
 
-    private static Map<String, String> resolveStaticPartition(FileStoreTable 
table,
-            Map<String, String> requested, Set<String> nullKeys) {
+    /**
+     * The static partition as Paimon's static overwrite parses it: SQL NULL 
becomes the table's
+     * {@code partition.default-name}, and every other value is the one the 
written rows carry, cast to the
+     * column type.
+     */
+    static Map<String, String> resolveStaticPartition(FileStoreTable table, 
ConnectorWriteHandle writeHandle) {
         Map<String, String> canonicalNames = new 
TreeMap<>(String.CASE_INSENSITIVE_ORDER);
         for (String partitionKey : table.partitionKeys()) {
             canonicalNames.put(partitionKey, partitionKey);
         }
         String defaultPartitionName = 
CoreOptions.fromMap(table.options()).partitionDefaultName();
+        Map<String, String> castValues = 
writeHandle.getCastStaticPartitionSpec();
         Map<String, String> result = new LinkedHashMap<>();

Review Comment:
   [P2] Avoid casting static partition metadata for append writes. 
`resolveStaticPartition` calls `getCastStaticPartitionSpec()` for `INSERT 
INTO`, although Paimon consumes this map only in `withOverwrite`. For a 
`VARBINARY(2)` partition, `PARTITION (p = X'4142')` reaches 
`checkedCastTo(VARBINARY(2))` from a MAX-length binary literal and throws, 
while the bound row cast accepts it. With a nullable INT partition and 
non-strict casts, `PARTITION (p = 'bad')` similarly becomes NULL in the row 
path but throws in this unused metadata path. Request the cast map only for 
overwrite so valid append inserts retain the row path's coercion.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to