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

Method AppendValue

cpp/src/arrow/json/from_string.cc:363–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

361 Status Init() override { return this->MakeConcreteBuilder(&builder_); }
362
363 Status AppendValue(const rj::Value& json_obj) override {
364 if (json_obj.IsNull()) {
365 return this->AppendNull();
366 }
367 if (json_obj.IsString()) {
368 int32_t precision, scale;
369 DecimalValue d;
370 auto view = std::string_view(json_obj.GetString(), json_obj.GetStringLength());
371 RETURN_NOT_OK(DecimalValue::FromString(view, &d, &precision, &scale));
372 if (scale != decimal_type_->scale()) {
373 return Status::Invalid("Invalid scale for decimal: expected ",
374 decimal_type_->scale(), ", got ", scale);
375 }
376 return builder_->Append(d);
377 }
378 return JSONTypeError("decimal string", json_obj.GetType());
379 }
380
381 std::shared_ptr<ArrayBuilder> builder() override { return builder_; }
382

Callers

nothing calls this directly

Calls 9

FromStringFunction · 0.85
JSONTypeErrorFunction · 0.85
InvalidFunction · 0.50
IsNullMethod · 0.45
AppendNullMethod · 0.45
GetStringMethod · 0.45
scaleMethod · 0.45
AppendMethod · 0.45
GetTypeMethod · 0.45

Tested by

no test coverage detected