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

Function WriteColumnV1

cpp/src/arrow/ipc/feather.cc:638–671  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

636}
637
638Status 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
673Status WriteFeatherV1(const Table& table, io::OutputStream* dst) {
674 // Preamble

Callers 1

WriteFeatherV1Function · 0.85

Calls 9

WriteArrayV1Function · 0.85
timezoneMethod · 0.80
InvalidFunction · 0.50
OKFunction · 0.50
num_chunksMethod · 0.45
type_idMethod · 0.45
dictionaryMethod · 0.45
typeMethod · 0.45
unitMethod · 0.45

Tested by

no test coverage detected