LuciferYang opened a new pull request, #1010:
URL: https://github.com/apache/iceberg-cpp/pull/1010

   ## What
   
   `TypeFromJson` built `DecimalType` straight from the regex-parsed precision. 
The constructor throws `IcebergError` for a precision above 38, so a type 
string such as `"decimal(39, 2)"` threw out of a `Result`-returning parser 
instead of producing a `JsonParseError`. This reaches table-metadata reads and 
REST bodies that carry a schema.
   
   Closes #1009.
   
   ## How
   
   Return `JsonParseError` when the parsed precision exceeds 
`DecimalType::kMaxPrecision`, before the type is constructed. The regex only 
captures digits and `ParseNumber` rejects int32 overflow, so no lower-bound 
check is needed.
   
   ## Testing
   
   `TypeJsonTest.FromJsonOutOfRangeDecimalPrecisionIsParseError` parses 
`"decimal(39, 2)"` and expects `kJsonParseError`. Without the fix it fails with 
`DecimalType: precision must be in [0, 38], was 39` thrown in the test body.
   


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