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


##########
be/src/format/transformer/vorc_transformer.cpp:
##########
@@ -510,16 +573,13 @@ bool VOrcTransformer::_collect_column_bounds(const 
orc::ColumnStatistics* col_st
     } else if (const auto* decimal_stats =
                        dynamic_cast<const 
orc::DecimalColumnStatistics*>(col_stats)) {
         if (decimal_stats->hasMinimum() && decimal_stats->hasMaximum()) {
-            has_bounds = true;
             (*lower_bounds)[field_id] = 
_decimal_to_bytes(decimal_stats->getMinimum());

Review Comment:
   ORC decimal bounds still need to be normalized to Iceberg's signed unscaled 
decimal bytes before committing. This branch passes 
`decimal_stats->getMinimum()` / `getMaximum()` straight into 
`_decimal_to_bytes()`, and that helper writes only `orc::Decimal::value`; it 
never rescales the ORC statistic to the target `DecimalType::get_scale()`. The 
current generated output already shows the scale bug for `decimal_col3 
decimal(18,6)`: inserted/read values are `1234.567890` and `8765.432100`, 
Parquet encodes field 8 as `0x00000000499602D2` / `0x000000020A75E124`, but ORC 
commits `0x075BCD15` / `0x05397FB1`, which Iceberg readable metrics decode as 
`123.456789` / `87.654321`. `_decimal_to_bytes()` also re-complements negative 
`orc::Int128` values into positive magnitudes before serializing, so negative 
decimal bounds would be committed with the wrong sign. Please rescale the ORC 
statistic to the Iceberg decimal field scale and then serialize the signed 
unscaled integer as two's-complement 
 minimal bytes; add regression coverage for both trailing-zero scale 
normalization and a negative decimal bound.



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