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

Function VerifyCorrectNumberOfWords_FixedWidth

cpp/src/arrow/acero/tpch_node_test.cc:271–291  ·  view source on GitHub ↗

Same as above but for fixed width columns.

Source from the content-addressed store, hash-verified

269
270// Same as above but for fixed width columns.
271void VerifyCorrectNumberOfWords_FixedWidth(const Datum& d, int num_words,
272 int byte_width) {
273 int expected_num_spaces = num_words - 1;
274 int64_t length = d.length();
275 const char* str = reinterpret_cast<const char*>(d.array()->buffers[1]->data());
276
277 for (int64_t i = 0; i < length; i++) {
278 int actual_num_spaces = 0;
279 const char* row = str + i * byte_width;
280 bool is_only_alphas_or_spaces = true;
281 for (int32_t j = 0; j < byte_width && row[j]; j++) {
282 bool is_space = row[j] == ' ';
283 actual_num_spaces += is_space;
284 is_only_alphas_or_spaces &= (is_space || std::isalpha(row[j]));
285 }
286 ASSERT_TRUE(is_only_alphas_or_spaces)
287 << "Words must be composed only of letters, got " << row;
288 ASSERT_EQ(actual_num_spaces, expected_num_spaces)
289 << "Wrong number of spaces in " << row;
290 }
291}
292
293// Verifies that each row of the single-byte-wide column is one of the possibilities.
294void VerifyOneOf(const Datum& d, const std::unordered_set<char>& possibilities) {

Callers 2

VerifyPartFunction · 0.85
VerifyCustomerFunction · 0.85

Calls 3

lengthMethod · 0.45
dataMethod · 0.45
arrayMethod · 0.45

Tested by

no test coverage detected