| 1255 | } |
| 1256 | |
| 1257 | Status ProcessDecimal() { |
| 1258 | RETURN_NOT_OK(f_parser_.CheckNext(':')); |
| 1259 | ARROW_ASSIGN_OR_RAISE(auto prec_scale, f_parser_.ParseInts(f_parser_.Rest())); |
| 1260 | // 3 elements indicates bit width was communicated as well. |
| 1261 | if (prec_scale.size() != 2 && prec_scale.size() != 3) { |
| 1262 | return f_parser_.Invalid(); |
| 1263 | } |
| 1264 | if (prec_scale[0] <= 0) { |
| 1265 | return f_parser_.Invalid(); |
| 1266 | } |
| 1267 | if (prec_scale.size() == 2) { |
| 1268 | ARROW_ASSIGN_OR_RAISE(type_, Decimal128Type::Make(prec_scale[0], prec_scale[1])); |
| 1269 | } else if (prec_scale[2] == 32) { |
| 1270 | ARROW_ASSIGN_OR_RAISE(type_, Decimal32Type::Make(prec_scale[0], prec_scale[1])); |
| 1271 | } else if (prec_scale[2] == 64) { |
| 1272 | ARROW_ASSIGN_OR_RAISE(type_, Decimal64Type::Make(prec_scale[0], prec_scale[1])); |
| 1273 | } else if (prec_scale[2] == 128) { |
| 1274 | ARROW_ASSIGN_OR_RAISE(type_, Decimal128Type::Make(prec_scale[0], prec_scale[1])); |
| 1275 | } else if (prec_scale[2] == 256) { |
| 1276 | ARROW_ASSIGN_OR_RAISE(type_, Decimal256Type::Make(prec_scale[0], prec_scale[1])); |
| 1277 | } else { |
| 1278 | return f_parser_.Invalid(); |
| 1279 | } |
| 1280 | |
| 1281 | return Status::OK(); |
| 1282 | } |
| 1283 | |
| 1284 | Status ProcessPrimitive(const std::shared_ptr<DataType>& type) { |
| 1285 | RETURN_NOT_OK(f_parser_.CheckAtEnd()); |