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

Method WriteIntegerField

cpp/src/arrow/integration/json_internal.cc:659–679  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

657
658 template <typename T>
659 void WriteIntegerField(const char* name, const T* values, int64_t length) {
660 writer_->Key(name);
661 writer_->StartArray();
662 if (sizeof(T) < sizeof(int64_t)) {
663 for (int i = 0; i < length; ++i) {
664 writer_->Int64(values[i]);
665 }
666 } else {
667 // Represent 64-bit integers as strings, as JSON numbers cannot represent
668 // them exactly.
669 ::arrow::internal::StringFormatter<typename CTypeTraits<T>::ArrowType> formatter;
670 auto append = [this](std::string_view v) {
671 writer_->String(std::string_view(v.data(), v.size()));
672 return Status::OK();
673 };
674 for (int i = 0; i < length; ++i) {
675 DCHECK_OK(formatter(values[i], append));
676 }
677 }
678 writer_->EndArray();
679 }
680
681 template <typename ArrayType>
682 void WriteBinaryViewField(const ArrayType& array) {

Callers

nothing calls this directly

Calls 8

OKFunction · 0.50
KeyMethod · 0.45
StartArrayMethod · 0.45
Int64Method · 0.45
StringMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
EndArrayMethod · 0.45

Tested by

no test coverage detected