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

Function CountModifiedComments

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

For the S_COMMENT column, some of the columns must be modified to contain "Customer...Complaints" or "Customer...Recommends". This function counts the number of good and bad comments.

Source from the content-addressed store, hash-verified

324// "Customer...Complaints" or "Customer...Recommends". This function counts the number of
325// good and bad comments.
326void CountModifiedComments(const Datum& d, int* good_count, int* bad_count) {
327 int64_t length = d.length();
328 const int32_t* offsets =
329 reinterpret_cast<const int32_t*>(d.array()->buffers[1]->data());
330 const char* str = reinterpret_cast<const char*>(d.array()->buffers[2]->data());
331 for (int64_t i = 0; i < length; i++) {
332 const char* row = str + offsets[i];
333 int32_t row_length = offsets[i + 1] - offsets[i];
334 std::string_view view(row, row_length);
335 bool customer = view.find("Customer") != std::string_view::npos;
336 bool recommends = view.find("Recommends") != std::string_view::npos;
337 bool complaints = view.find("Complaints") != std::string_view::npos;
338 if (customer) {
339 ASSERT_TRUE(recommends ^ complaints);
340 if (recommends) *good_count += 1;
341 if (complaints) *bad_count += 1;
342 }
343 }
344}
345
346void VerifySupplier(const std::vector<ExecBatch>& batches,
347 double scale_factor = kDefaultScaleFactor) {

Callers 1

VerifySupplierFunction · 0.85

Calls 4

lengthMethod · 0.45
dataMethod · 0.45
arrayMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected