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

Method Flatten

cpp/src/arrow/table.cc:164–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162 }
163
164 Result<std::shared_ptr<Table>> Flatten(MemoryPool* pool) const override {
165 std::vector<std::shared_ptr<Field>> flattened_fields;
166 std::vector<std::shared_ptr<ChunkedArray>> flattened_columns;
167 for (int i = 0; i < num_columns(); ++i) {
168 std::vector<std::shared_ptr<Field>> new_fields = field(i)->Flatten();
169 ARROW_ASSIGN_OR_RAISE(auto new_columns, column(i)->Flatten(pool));
170 DCHECK_EQ(new_columns.size(), new_fields.size());
171 for (size_t j = 0; j < new_columns.size(); ++j) {
172 flattened_fields.push_back(new_fields[j]);
173 flattened_columns.push_back(new_columns[j]);
174 }
175 }
176 auto flattened_schema =
177 std::make_shared<Schema>(std::move(flattened_fields), schema_->metadata());
178 return Table::Make(std::move(flattened_schema), std::move(flattened_columns));
179 }
180
181 Status Validate() const override {
182 RETURN_NOT_OK(ValidateMeta());

Callers

nothing calls this directly

Calls 6

push_backMethod · 0.80
num_columnsFunction · 0.70
fieldFunction · 0.70
MakeFunction · 0.70
sizeMethod · 0.45
metadataMethod · 0.45

Tested by

no test coverage detected