| 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) { |
no test coverage detected