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

Method Validate

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

Source from the content-addressed store, hash-verified

26namespace internal {
27
28Status Trie::Validate() const {
29 const auto n_nodes = static_cast<fast_index_type>(nodes_.size());
30 if (size_ > n_nodes) {
31 return Status::Invalid("Number of entries larger than number of nodes");
32 }
33 for (const auto& node : nodes_) {
34 if (node.found_index_ >= size_) {
35 return Status::Invalid("Found index >= size");
36 }
37 if (node.child_lookup_ != -1 &&
38 node.child_lookup_ * 256 >
39 static_cast<fast_index_type>(lookup_table_.size() - 256)) {
40 return Status::Invalid("Child lookup base doesn't point to 256 valid indices");
41 }
42 }
43 for (const auto index : lookup_table_) {
44 if (index >= n_nodes) {
45 return Status::Invalid("Child lookup index out of bounds");
46 }
47 }
48 return Status::OK();
49}
50
51void Trie::Dump(const Node* node, const std::string& indent) const {
52 std::cerr << "[\"" << node->substring_ << "\"]";

Calls 3

InvalidFunction · 0.50
OKFunction · 0.50
sizeMethod · 0.45

Tested by 13

ValidateFullFunction · 0.36
TEST_FFunction · 0.36
StartAndFinishFunction · 0.36
StartAndCollectFunction · 0.36
MakeRandomMapArrayFunction · 0.36
TESTFunction · 0.36
TestRandomFunction · 0.36
TestMergeFunction · 0.36
TestTrieContentsFunction · 0.36
TESTFunction · 0.36
CheckToTensorFunction · 0.36