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

Method SetColumn

cpp/src/arrow/table.cc:139–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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