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

Method SplitNode

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

Source from the content-addressed store, hash-verified

128}
129
130Status TrieBuilder::SplitNode(fast_index_type node_index, fast_index_type split_at) {
131 Trie::Node* node = &trie_.nodes_[node_index];
132
133 DCHECK_LT(split_at, node->substring_length());
134
135 // Before:
136 // {node} -> [...]
137 // After:
138 // {node} -> [c] -> {out_node} -> [...]
139 auto child_node = Trie::Node{node->found_index_, node->child_lookup_,
140 node->substring_.substr(split_at + 1)};
141 auto ch = node->substring_[split_at];
142 node->child_lookup_ = -1;
143 node->found_index_ = -1;
144 node->substring_ = node->substring_.substr(0, split_at);
145 RETURN_NOT_OK(AppendChildNode(node, ch, std::move(child_node)));
146
147 return Status::OK();
148}
149
150Status TrieBuilder::Append(std::string_view s, bool allow_duplicate) {
151 // Find or create node for string

Callers

nothing calls this directly

Calls 3

substring_lengthMethod · 0.80
substrMethod · 0.80
OKFunction · 0.50

Tested by

no test coverage detected