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

Function WriteColumnV1

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

Source from the content-addressed store, hash-verified

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