MCPcopy Create free account
hub / github.com/apache/arrow / ProcessDecimal

Method ProcessDecimal

cpp/src/arrow/c/bridge.cc:1260–1285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

CheckNextMethod · 0.80
InvalidMethod · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.50
MakeFunction · 0.50
OKFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected