leaves12138 commented on code in PR #9825:
URL: https://github.com/apache/paimon/pull/9825#discussion_r4012097610


##########
paimon-python/pypaimon/utils/file_store_path_factory.py:
##########
@@ -98,7 +146,39 @@ def data_file_path(self) -> str:
             return f"{self._root}/{self.data_file_path_directory}"
         return self._root
 
-    def relative_bucket_path(self, partition: Tuple, bucket: int) -> str:
+    def relative_bucket_path(self, partition: Tuple, bucket: int, 
canonical_partition: bool = False) -> str:
+        if canonical_partition and partition:
+            partition = self._canonical_partition(partition)
+        return self._relative_bucket_path(partition, bucket, 
canonical_partition)
+
+    def _canonical_partition(self, partition: Tuple) -> Tuple[str, ...]:
+        values = []
+        for i, value in enumerate(partition):
+            data_type = self.partition_types[i] if self.partition_types is not 
None else None
+            type_name = str(data_type).split('(', 1)[0].split()[0]
+            if _is_null_or_whitespace_only(value):
+                text = self.default_part_value
+            elif type_name in ('FLOAT', 'REAL', 'DOUBLE'):
+                text = _floating_partition_string(value, type_name != 'DOUBLE')
+            elif self.legacy_partition_name and type_name == 'DATE':
+                text = str((value - date(1970, 1, 1)).days)
+            elif self.legacy_partition_name and 
type_name.startswith('TIMESTAMP'):
+                text = value.isoformat(timespec='minutes')
+                if value.second or value.microsecond:
+                    text = value.isoformat(timespec='microseconds' if 
value.microsecond else 'seconds')
+                    if value.microsecond and value.microsecond % 1000 == 0:
+                        text = text[:-3]

Review Comment:
   Verified fixed in `10b5984866bf3e7e23fc2f47fc2dfae1554be7f2`. All four 
original reproductions now pass. I additionally compared the paths directly 
with Java in UTC, Asia/Shanghai, and America/New_York, and verified canonical 
bucket-DV reads, repeated deletion, and historical reads with both Python and 
native planners using the binding from apache/paimon-rust#834. Resolving this 
thread.
   



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