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

Method AppendValue

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

Source from the content-addressed store, hash-verified

376 Status Init() override { return this->MakeConcreteBuilder(&builder_); }
377
378 Status AppendValue(sj::value& json_obj) override {
379 ARROW_ASSIGN_OR_RAISE(bool is_null, internal::IsJsonNull(json_obj));
380 if (is_null) {
381 return this->AppendNull();
382 }
383 ARROW_ASSIGN_OR_RAISE(auto string_value,
384 internal::GetJsonAs<std::string_view>(json_obj));
385 int32_t precision, scale;
386 DecimalValue d;
387 RETURN_NOT_OK(DecimalValue::FromString(string_value, &d, &precision, &scale));
388 if (scale != decimal_type_->scale()) {
389 return Status::Invalid("Invalid scale for decimal: expected ",
390 decimal_type_->scale(), ", got ", scale);
391 }
392 return builder_->Append(d);
393 }
394
395 std::shared_ptr<ArrayBuilder> builder() override { return builder_; }
396

Callers

nothing calls this directly

Calls 5

FromStringFunction · 0.85
InvalidFunction · 0.50
AppendNullMethod · 0.45
scaleMethod · 0.45
AppendMethod · 0.45

Tested by

no test coverage detected