JingsongLi commented on code in PR #1405:
URL: https://github.com/apache/paimon-rust/pull/1405#discussion_r4661567676
##########
crates/paimon/src/variant.rs:
##########
@@ -2914,12 +2985,17 @@ pub(crate) fn rebuild_shredded_with_cache(
false
};
let mut builder = if compact {
+ if metadata.len() > SIZE_LIMIT {
+ return data_invalid("Variant value or metadata exceeds constructor
size limit");
+ }
+ validate_metadata(metadata)?;
Review Comment:
**[P2] Reuse source dictionary validation in compact rebuilds**
Selecting a small Variant subtree can preserve its full parent dictionary.
For rows fully represented by `typed_value`, the baseline builds a compact
dictionary from the typed fields. This new call validates every key in the
source dictionary on a cache miss. Rotating dictionaries that exceed the 1 MiB
validation cache make each row repeat the UTF-8 and duplicate-key checks.
I reproduced this with 512 rows of `{"age":27}`, a shredded `age BIGINT`
field, and no residual value. The rows rotate through nine parent dictionaries,
each with 5,362 unused keys, totaling 1.10 MiB of distinct metadata. After an
in-memory Parquet round trip, I timed only Arrow reconstruction. The median of
14 debug rebuilds per commit rose from **2.7 ms** on the merge base `cb8633dc`
to **785 ms** on `2b06203e`.
Please reuse successful validation results in a bounded batch-local cache
that matches the full metadata bytes.
--
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]