Verifies that each row is the string "prefix" followed by a number. If numbers is not EMPTY, it also checks that the number following the prefix is equal to the corresponding row in numbers. Some TPC-H data is padded to 9 zeros, which this function can optionally verify as well. This string function verifies fixed width columns.
| 125 | // corresponding row in numbers. Some TPC-H data is padded to 9 zeros, which this function |
| 126 | // can optionally verify as well. This string function verifies fixed width columns. |
| 127 | void VerifyStringAndNumber_FixedWidth(const Datum& strings, const Datum& numbers, |
| 128 | int byte_width, std::string_view prefix, |
| 129 | bool verify_padding = true) { |
| 130 | int64_t length = strings.length(); |
| 131 | const char* str = reinterpret_cast<const char*>(strings.array()->buffers[1]->data()); |
| 132 | |
| 133 | const int32_t* nums = nullptr; |
| 134 | if (numbers.kind() != Datum::NONE) { |
| 135 | ASSERT_EQ(length, numbers.length()); |
| 136 | nums = reinterpret_cast<const int32_t*>(numbers.array()->buffers[1]->data()); |
| 137 | } |
| 138 | |
| 139 | for (int64_t i = 0; i < length; i++) { |
| 140 | const char* row = str + i * byte_width; |
| 141 | std::string_view view(row, byte_width); |
| 142 | VerifyStringAndNumber_Single(view, prefix, i, nums, verify_padding); |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | // Same as above but for variable length columns |
| 147 | void VerifyStringAndNumber_Varlen(const Datum& strings, const Datum& numbers, |
no test coverage detected