For an integer type, return the max number of decimal digits (=minimal decimal precision) it can represent.
| 500 | /// For an integer type, return the max number of decimal digits |
| 501 | /// (=minimal decimal precision) it can represent. |
| 502 | inline Result<int32_t> MaxDecimalDigitsForInteger(Type::type type_id) { |
| 503 | switch (type_id) { |
| 504 | case Type::INT8: |
| 505 | case Type::UINT8: |
| 506 | return 3; |
| 507 | case Type::INT16: |
| 508 | case Type::UINT16: |
| 509 | return 5; |
| 510 | case Type::INT32: |
| 511 | case Type::UINT32: |
| 512 | return 10; |
| 513 | case Type::INT64: |
| 514 | return 19; |
| 515 | case Type::UINT64: |
| 516 | return 20; |
| 517 | default: |
| 518 | break; |
| 519 | } |
| 520 | return Status::Invalid("Not an integer type: ", type_id); |
| 521 | } |
| 522 | |
| 523 | } // namespace arrow |
no test coverage detected