[C++] arrow::json::DecimalConverter should rescale values based on the explicit_schema #33200
Labels
Component: C++
Critical Fix
Bugfixes for security vulnerabilities, crashes, or invalid data.
Priority: Critical
Type: bug
Milestone
The C++ lib doesn't read JSON decimal values correctly based on the explicit_schema. This can be reproduced by this helloworld program: https://github.com/stiga-huang/arrow-helloworld/tree/d267862
The input JSON file has the following rows:
If we read the price column using decimal128(9, 2), the values are
If we use decimal128(9, 3) instead, the values are
The decimal type in the explicit_schema is set here: https://github.com/stiga-huang/arrow-helloworld/blob/d26786270e87d9ab847658ead96a96190461b98f/json_decimal_example.cc#L38
The cause is
arrow::json::DecimalConverter
doesn't rescale the value based on the out_type_:arrow/cpp/src/arrow/json/converter.cc
Lines 171 to 173 in cdd0fdf
Reporter: Quanlong Huang / @stiga-huang
Assignee: Quanlong Huang / @stiga-huang
PRs and other links:
Note: This issue was originally created as ARROW-17995. Please see the migration documentation for further details.
The text was updated successfully, but these errors were encountered: