MCPcopy Create free account
hub / github.com/apache/orc / checkDictionaryEncoding

Function checkDictionaryEncoding

c++/test/TestDictionaryEncoding.cc:50–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48 }
49
50 static void checkDictionaryEncoding(StringVectorBatch* batch) {
51 EXPECT_TRUE(batch->isEncoded);
52
53 const auto* encoded_batch = dynamic_cast<EncodedStringVectorBatch*>(batch);
54 EXPECT_TRUE(encoded_batch != nullptr);
55
56 const auto& dictionary = encoded_batch->dictionary;
57 EXPECT_TRUE(dictionary != nullptr);
58
59 // Check if the dictionary is sorted
60 std::string prev;
61 for (size_t i = 0; i < dictionary->dictionaryOffset.size() - 1; ++i) {
62 char* begin = nullptr;
63 int64_t length = 0;
64 dictionary->getValueByIndex(i, begin, length);
65
66 std::string curr = std::string(begin, static_cast<size_t>(length));
67 if (i) {
68 EXPECT_GT(curr, prev);
69 }
70
71 prev = std::move(curr);
72 }
73 }
74
75 static std::unique_ptr<RowReader> createRowReader(Reader* reader,
76 bool enableEncodedBlock = false) {

Callers 4

testStringDictionaryFunction · 0.85
testVarcharDictionaryFunction · 0.85
testCharDictionaryFunction · 0.85

Calls 2

getValueByIndexMethod · 0.80
sizeMethod · 0.65

Tested by

no test coverage detected