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

Method DoParse

cpp/src/arrow/json/parser.cc:766–794  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

764 protected:
765 template <typename Handler, typename Stream>
766 Status DoParse(Handler& handler, Stream&& json, size_t json_size) {
767 constexpr auto parse_flags = rj::kParseIterativeFlag | rj::kParseNanAndInfFlag |
768 rj::kParseStopWhenDoneFlag |
769 rj::kParseNumbersAsStringsFlag;
770
771 rj::Reader reader;
772 // ensure that the loop can exit when the block too large.
773 for (; num_rows_ < std::numeric_limits<int32_t>::max(); ++num_rows_) {
774 auto ok = reader.Parse<parse_flags>(json, handler);
775 switch (ok.Code()) {
776 case rj::kParseErrorNone:
777 // parse the next object
778 continue;
779 case rj::kParseErrorDocumentEmpty:
780 if (json.Tell() < json_size) {
781 return ParseError(rj::GetParseError_En(ok.Code()));
782 }
783 // parsed all objects, finish
784 return Status::OK();
785 case rj::kParseErrorTermination:
786 // handler emitted an error
787 return handler.Error();
788 default:
789 // rj emitted an error
790 return ParseError(rj::GetParseError_En(ok.Code()), " in row ", num_rows_);
791 }
792 }
793 return Status::Invalid("Row count overflowed int32_t");
794 }
795
796 template <typename Handler>
797 Status DoParse(Handler& handler, const std::shared_ptr<Buffer>& json) {

Callers

nothing calls this directly

Calls 8

ParseErrorFunction · 0.70
OKFunction · 0.70
InvalidFunction · 0.50
InputStreamClass · 0.50
TellMethod · 0.45
ErrorMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected