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

Class StructImpl

cpp/src/arrow/array/diff.cc:739–760  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

737
738 Status Visit(const StructType& t) {
739 struct StructImpl {
740 explicit StructImpl(std::vector<Formatter> f) : field_formatters_(std::move(f)) {}
741
742 void operator()(const Array& array, int64_t index, std::ostream* os) {
743 const auto& struct_array = checked_cast<const StructArray&>(array);
744 *os << "{";
745 for (int i = 0, printed = 0; i < struct_array.num_fields(); ++i) {
746 if (printed != 0) {
747 *os << ", ";
748 }
749 if (struct_array.field(i)->IsNull(index)) {
750 continue;
751 }
752 ++printed;
753 *os << struct_array.struct_type()->field(i)->name() << ": ";
754 field_formatters_[i](*struct_array.field(i), index, os);
755 }
756 *os << "}";
757 }
758
759 std::vector<Formatter> field_formatters_;
760 };
761
762 std::vector<Formatter> field_formatters(t.num_fields());
763 for (int i = 0; i < t.num_fields(); ++i) {

Callers 1

VisitMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected