| 636 | } |
| 637 | |
| 638 | Status WriteColumnV1(const ChunkedArray& values, io::OutputStream* dst, |
| 639 | ColumnMetadata* out) { |
| 640 | if (values.num_chunks() > 1) { |
| 641 | return Status::Invalid("Writing chunked arrays not supported in Feather V1"); |
| 642 | } |
| 643 | const Array& chunk = *values.chunk(0); |
| 644 | RETURN_NOT_OK(WriteArrayV1(chunk, dst, &out->values)); |
| 645 | switch (chunk.type_id()) { |
| 646 | case Type::DICTIONARY: { |
| 647 | out->meta_type = ColumnType::CATEGORY; |
| 648 | auto dictionary = checked_cast<const DictionaryArray&>(chunk).dictionary(); |
| 649 | RETURN_NOT_OK(WriteArrayV1(*dictionary, dst, &out->category_levels)); |
| 650 | out->category_ordered = |
| 651 | checked_cast<const DictionaryType&>(*chunk.type()).ordered(); |
| 652 | } break; |
| 653 | case Type::DATE32: |
| 654 | out->meta_type = ColumnType::DATE; |
| 655 | break; |
| 656 | case Type::TIME32: { |
| 657 | out->meta_type = ColumnType::TIME; |
| 658 | out->temporal_unit = checked_cast<const Time32Type&>(*chunk.type()).unit(); |
| 659 | } break; |
| 660 | case Type::TIMESTAMP: { |
| 661 | const auto& ts_type = checked_cast<const TimestampType&>(*chunk.type()); |
| 662 | out->meta_type = ColumnType::TIMESTAMP; |
| 663 | out->temporal_unit = ts_type.unit(); |
| 664 | out->timezone = ts_type.timezone(); |
| 665 | } break; |
| 666 | default: |
| 667 | out->meta_type = ColumnType::PRIMITIVE; |
| 668 | break; |
| 669 | } |
| 670 | return Status::OK(); |
| 671 | } |
| 672 | |
| 673 | Status WriteFeatherV1(const Table& table, io::OutputStream* dst) { |
| 674 | // Preamble |
no test coverage detected