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

Method AppendChildNode

cpp/src/arrow/util/trie.cc:76–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74TrieBuilder::TrieBuilder() { trie_.nodes_.push_back(Trie::Node{-1, -1, ""}); }
75
76Status TrieBuilder::AppendChildNode(Trie::Node* parent, uint8_t ch, Trie::Node&& node) {
77 if (parent->child_lookup_ == -1) {
78 RETURN_NOT_OK(ExtendLookupTable(&parent->child_lookup_));
79 }
80 auto parent_lookup = parent->child_lookup_ * 256 + ch;
81
82 DCHECK_EQ(trie_.lookup_table_[parent_lookup], -1);
83 if (trie_.nodes_.size() >= static_cast<size_t>(kMaxIndex)) {
84 auto max_capacity = kMaxIndex;
85 return Status::CapacityError("TrieBuilder cannot contain more than ", max_capacity,
86 " child nodes");
87 }
88 trie_.nodes_.push_back(std::move(node));
89 trie_.lookup_table_[parent_lookup] = static_cast<index_type>(trie_.nodes_.size() - 1);
90 return Status::OK();
91}
92
93Status TrieBuilder::CreateChildNode(Trie::Node* parent, uint8_t ch,
94 std::string_view substring) {

Callers

nothing calls this directly

Calls 4

CapacityErrorFunction · 0.85
push_backMethod · 0.80
OKFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected