JingsongLi commented on code in PR #8319:
URL: https://github.com/apache/paimon/pull/8319#discussion_r3456939113
##########
paimon-python/pypaimon/tag/tag_manager.py:
##########
@@ -173,7 +179,16 @@ def _create_or_replace_tag(
if not self.file_io.exists(tag_dir):
self.file_io.mkdirs(tag_dir)
- content = JSON.to_json(snapshot)
+ # Mirror Java TagManager.createOrReplaceTag: when no retention is set,
+ # write the plain Snapshot JSON (no tag-specific fields) so the file
+ # stays readable by older readers. Only write the richer Tag JSON when
a
+ # retention (and thus a create-time) is present.
+ if time_retained is not None:
+ retained = timedelta(milliseconds=parse_duration(time_retained))
Review Comment:
`parse_duration` returns an integer millisecond count, so wrapping it with
`timedelta(milliseconds=...)` loses the sub-millisecond units that the same
option accepts on the Java side. For example, Java
`TimeUtils.parseDuration("1ns")` creates a one-nanosecond `Duration`, but this
path parses it to `0` and writes `tagTimeRetained: 0.0` / `PT0S`. `500micro` is
also rounded to zero. Could we either preserve the parsed duration at
micro/nano precision here, or reject sub-millisecond `time_retained` values
instead of silently creating a zero-TTL tag?
--
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]