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

Method SetColumn

cpp/src/arrow/table.cc:138–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136 }
137
138 Result<std::shared_ptr<Table>> SetColumn(
139 int i, std::shared_ptr<Field> field_arg,
140 std::shared_ptr<ChunkedArray> col) const override {
141 DCHECK(col != nullptr);
142
143 if (col->length() != num_rows_) {
144 return Status::Invalid(
145 "Added column's length must match table's length. Expected length ", num_rows_,
146 " but got length ", col->length());
147 }
148
149 if (!field_arg->type()->Equals(col->type())) {
150 return Status::Invalid("Field type did not match data type");
151 }
152
153 ARROW_ASSIGN_OR_RAISE(auto new_schema, schema_->SetField(i, field_arg));
154 return Table::Make(std::move(new_schema),
155 internal::ReplaceVectorElement(columns_, i, std::move(col)));
156 }
157
158 std::shared_ptr<Table> ReplaceSchemaMetadata(
159 const std::shared_ptr<const KeyValueMetadata>& metadata) const override {

Callers 6

CastMethod · 0.45
ASSERT_OK_AND_ASSIGNFunction · 0.45
TESTFunction · 0.45
RecordBatch__SetColumnFunction · 0.45
Table__SetColumnFunction · 0.45

Calls 6

ReplaceVectorElementFunction · 0.85
InvalidFunction · 0.70
MakeFunction · 0.70
lengthMethod · 0.45
EqualsMethod · 0.45
typeMethod · 0.45

Tested by 2

ASSERT_OK_AND_ASSIGNFunction · 0.36
TESTFunction · 0.36