Construct an array of decimals, where negative scale is allowed. Works around DecimalXXX::FromString intentionally not inferring negative scales.
| 75 | // Works around DecimalXXX::FromString intentionally not inferring |
| 76 | // negative scales. |
| 77 | inline std::shared_ptr<Array> DecimalArrayFromJSON(const std::shared_ptr<DataType>& type, |
| 78 | const std::string& json) { |
| 79 | const auto& ty = checked_cast<const DecimalType&>(*type); |
| 80 | if (ty.scale() >= 0) return ArrayFromJSON(type, json); |
| 81 | auto p = ty.precision() - ty.scale(); |
| 82 | auto adjusted_ty = ty.id() == Type::DECIMAL128 ? decimal128(p, 0) : decimal256(p, 0); |
| 83 | return Cast(ArrayFromJSON(adjusted_ty, json), type).ValueOrDie().make_array(); |
| 84 | } |
| 85 | |
| 86 | inline std::shared_ptr<Scalar> DecimalScalarFromJSON( |
| 87 | const std::shared_ptr<DataType>& type, const std::string& json) { |
no test coverage detected