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

Method Convert

cpp/src/arrow/csv/converter.cc:611–636  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

609 }
610
611 Result<std::shared_ptr<Array>> Convert(const BlockParser& parser,
612 int32_t col_index) override {
613 // We use a fixed index width so that all column chunks get the same index type
614 using BuilderType = Dictionary32Builder<T>;
615 using value_type = typename ValueDecoderType::value_type;
616
617 BuilderType builder(value_type_, pool_);
618 RETURN_NOT_OK(PresizeBuilder(parser, &builder));
619
620 auto visit = [&](const uint8_t* data, uint32_t size, bool quoted) -> Status {
621 if (decoder_.IsNull(data, size, quoted /* quoted */)) {
622 return builder.AppendNull();
623 }
624 if (ARROW_PREDICT_FALSE(builder.dictionary_length() > max_cardinality_)) {
625 return Status::IndexError("Dictionary length exceeded max cardinality");
626 }
627 value_type value{};
628 RETURN_NOT_OK(decoder_.Decode(data, size, quoted, &value));
629 return builder.Append(value);
630 };
631 RETURN_NOT_OK(parser.VisitColumn(col_index, visit));
632
633 std::shared_ptr<Array> res;
634 RETURN_NOT_OK(builder.Finish(&res));
635 return res;
636 }
637
638 void SetMaxCardinality(int32_t max_length) override { max_cardinality_ = max_length; }
639

Callers

nothing calls this directly

Calls 8

PresizeBuilderFunction · 0.85
IndexErrorFunction · 0.85
dictionary_lengthMethod · 0.80
IsNullMethod · 0.45
AppendNullMethod · 0.45
DecodeMethod · 0.45
AppendMethod · 0.45
FinishMethod · 0.45

Tested by

no test coverage detected