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


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonUtil.java:
##########
@@ -162,47 +163,50 @@ public static PaimonPartitionInfo 
generatePartitionInfo(List<Column> partitionCo
         List<Type> types = partitionColumns.stream()
                 .map(Column::getType)
                 .collect(Collectors.toList());
-        Map<String, Type> columnNameToType = partitionColumns.stream()
-                .collect(Collectors.toMap(Column::getName, Column::getType));
 
         for (Partition partition : paimonPartitions) {
             Map<String, String> spec = partition.spec();
-            StringBuilder sb = new StringBuilder();
-            for (Map.Entry<String, String> entry : spec.entrySet()) {
-                sb.append(entry.getKey()).append("=");
+            // Paimon partition specs contain logical values, which may 
include path separators.
+            // Build partition values directly instead of parsing them as a 
Hive partition path.
+            List<String> partitionValues = 
Lists.newArrayListWithExpectedSize(partitionColumns.size());
+            LinkedHashMap<String, String> orderedPartitionSpec = new 
LinkedHashMap<>();
+            for (Column partitionColumn : partitionColumns) {

Review Comment:
   **[P2] Preserve Paimon's declared partition-key order**
   
   This loop uses `partitionColumns` as the canonical name order, but the 
production list is built by filtering `TableSchema.fields()` in 
`PaimonExternalTable.initSchema`; Paimon keeps `partitionKeys()` as an 
independent ordered list and emits `Partition.spec()` in that declared order. 
For fields `[dt, region]` with `PARTITIONED BY (region, dt)`, this changes the 
identity from `region=us/dt=2024-01-15` to `dt=2024-01-15/region=us`. Typed 
pruning values happen to remain aligned with Doris's field-ordered list, but 
`SHOW PARTITIONS` now exposes a non-Paimon name and persisted MTMV partition 
keys change whenever field order differs or is reordered.
   
   Please build/cache the Doris partition columns in 
`tableSchema.partitionKeys()` order (or pass that order explicitly) and use it 
for the types, values, and escaped name. The test should exercise a schema 
whose field order differs from its declared partition-key order; the current 
test only permutes `spec.entrySet()` while manually passing the expected column 
order.
   



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