sdk2 commented on code in PR #69404:
URL: https://github.com/apache/doris/pull/69404#discussion_r4796700150


##########
fe/fe-connector/fe-connector-hive/src/main/java/org/apache/doris/connector/hive/HiveWritePlanProvider.java:
##########
@@ -351,6 +354,32 @@ private List<THivePartition> 
buildExistingPartitions(HmsTableInfo table) {
         return partitions;
     }
 
+    private static Optional<String> fullyStaticPartitionName(HmsTableInfo 
table, ConnectorWriteHandle handle) {
+        // Typed partition text can differ between FE literals and BE 
directory formatting (e.g. BOOLEAN
+        // true versus 1). Narrow only string partitions, whose cast values 
are the bytes BE will write.
+        for (ConnectorColumn column : table.getPartitionKeys()) {
+            String type = column.getType().getTypeName();
+            if (!"STRING".equalsIgnoreCase(type) && 
!"VARCHAR".equalsIgnoreCase(type)
+                    && !"CHAR".equalsIgnoreCase(type)) {
+                return Optional.empty();
+            }
+        }
+        Map<String, String> spec = new 
TreeMap<>(String.CASE_INSENSITIVE_ORDER);
+        spec.putAll(handle.getCastStaticPartitionSpec());
+        List<String> names = new ArrayList<>(table.getPartitionKeys().size());
+        List<String> values = new ArrayList<>(table.getPartitionKeys().size());
+        for (ConnectorColumn column : table.getPartitionKeys()) {
+            String value = spec.get(column.getName());
+            if (value == null) {
+                // A missing value denotes a dynamic partition or SQL NULL; 
retain the existing full load.
+                return Optional.empty();
+            }
+            names.add(column.getName().toLowerCase(Locale.ROOT));
+            values.add(value);
+        }
+        return Optional.of(FileUtils.makePartName(names, values));

Review Comment:
   Done: `fullyStaticPartitionName` now calls `HiveWriteUtils.makePartName`, 
and the unused `FileUtils` / `Locale` imports are removed. The helper already 
lowercases keys, escapes values, and maps an empty value to 
`__HIVE_DEFAULT_PARTITION__`. `HiveWritePlanProviderTest` 42/42.



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