[python] Render min/max_partition_stats in the $manifests system table#8842
Open
wombatu-kun wants to merge 1 commit into
Open
[python] Render min/max_partition_stats in the $manifests system table#8842wombatu-kun wants to merge 1 commit into
wombatu-kun wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This closes a TODO in
pypaimon/table/system/manifests_table.py:So
$manifestsreturns NULL formin_partition_statsandmax_partition_statsin pypaimon while Java renders them, and inspecting which manifests cover which partitions gives nothing on the Python side. The data is already parsed:ManifestListManagerbuildsSimpleStatsfrom the manifest list, only the rendering was missing.This adds
cast_row_to_string, the helper the TODO asks for: a port ofRowToStringCastRuleand the per type*ToStringCastRulerules ofpaimon-common, with fields joined by", "inside braces, the literalnullfor a null field, and{}for an unpartitioned table. The types that need more thanstr()are boolean (lower case), binary (decoded as UTF-8), date, time, timestamp and float. Timestamps followDateTimeUtils.formatTimestamp, which separates date and time with a space and strips trailing zeros of the fraction down to the declared precision, sodatetime.isoformat()can not be used. Floats print the shortest text that round trips as float32, otherwise a float320.1read into a Python float prints as0.10000000149011612.One point for a maintainer opinion, deliberately not changed here: pypaimon renders the
partitioncolumn of$filesand$bucketsaspt=v/pt2=v2, while Java renders those two with the brace form and keepspt=vonly for$partitions. Aligning them would change values these tables already return, so it is out of scope for this PR.Tests
New
pypaimon/tests/row_to_string_test.pycovers the rendering per type, including a null field, an empty row, the timestamp fraction at precision 0/3/6 and the float32 shortest form.pypaimon/tests/system/manifests_table_test.pyreplaces the assertions that pinned the NULL placeholder: an unpartitioned table now yields{}, and a table partitioned by INT and STRING yields{1, 2024-01-01}and{2, 2024-01-02}.Cross checked against Java on a single warehouse: a table written by pypaimon and partitioned by INT, STRING, DATE, BOOLEAN and DECIMAL renders identically on both sides.