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

Method ProcessDecimal

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

Source from the content-addressed store, hash-verified

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