WZhuo opened a new issue, #1143:
URL: https://github.com/apache/iceberg-cpp/issues/1143

   The iceberg-verification fixture 
[`types/primitive/decimal-precision-over-38`](https://github.com/apache/iceberg-verification/blob/fb0be4d6cb2af5529a176b976b4a775dc87b778f/table-spec/types/primitive/cases.json#L192)
 expects `TypeFromJson("decimal(39,0)")` to fail, because the spec requires 
[precision of 38 or 
less](https://github.com/apache/iceberg/blob/1440e49e39a7c436a687b0289be067a5cf411e2c/format/spec.md#L287).
 It does fail, but by throwing instead of returning an error (#909):
   
   ```
   DecimalType: precision must be in [0, 38], was 39
   ```
   
   `TypeFromJson` passes the parsed precision straight to 
[`std::make_unique<DecimalType>(precision, 
scale)`](https://github.com/apache/iceberg-cpp/blob/77fbd76e50dc8d5fb296bd8214a6fd7fe20627f7/src/iceberg/json_serde.cc#L858).
 The constructor checks the range with 
[`ICEBERG_CHECK_OR_DIE`](https://github.com/apache/iceberg-cpp/blob/77fbd76e50dc8d5fb296bd8214a6fd7fe20627f7/src/iceberg/type.cc#L303),
 which [throws 
`IcebergError`](https://github.com/apache/iceberg-cpp/blob/77fbd76e50dc8d5fb296bd8214a6fd7fe20627f7/src/iceberg/exception.h#L33-L38).
 `SchemaFromJson` hits the same path for any decimal field, so a schema or 
table metadata with an out-of-range decimal also throws.
   
   `TypeFromJson` could check precision against `DecimalType::kMaxPrecision` 
before constructing the type and return a `JsonParseError`, as it already does 
for a malformed decimal string.
   


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