| 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 |
nothing calls this directly
no test coverage detected