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

Method EncodeType

cpp/src/arrow/engine/substrait/extension_set.cc:302–315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300}
301
302Result<uint32_t> ExtensionSet::EncodeType(const DataType& type) {
303 if (auto rec = registry_->GetType(type)) {
304 RETURN_NOT_OK(this->AddUri(rec->id));
305 auto it_success =
306 types_map_.emplace(rec->id, static_cast<uint32_t>(types_map_.size()));
307 if (it_success.second) {
308 DCHECK_EQ(types_.find(static_cast<uint32_t>(types_.size())), types_.end())
309 << "Type existed in types_ but not types_map_. ExtensionSet is inconsistent";
310 types_[static_cast<uint32_t>(types_.size())] = {rec->id, rec->type};
311 }
312 return it_success.first->second;
313 }
314 return Status::KeyError("type ", type.ToString(), " not found in the registry");
315}
316
317Result<Id> ExtensionSet::DecodeFunction(uint32_t anchor) const {
318 if (functions_.find(anchor) == functions_.end() || functions_.at(anchor).empty()) {

Callers 2

TESTFunction · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.80

Calls 7

AddUriMethod · 0.95
KeyErrorFunction · 0.85
GetTypeMethod · 0.45
sizeMethod · 0.45
findMethod · 0.45
endMethod · 0.45
ToStringMethod · 0.45

Tested by 1

TESTFunction · 0.64