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

Function VerifyPhone

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

Verifies that each row satisfies the phone number spec.

Source from the content-addressed store, hash-verified

216
217// Verifies that each row satisfies the phone number spec.
218void VerifyPhone(const Datum& d) {
219 int64_t length = d.length();
220 const char* phones = reinterpret_cast<const char*>(d.array()->buffers[1]->data());
221 constexpr int kByteWidth = 15; // This is common for all PHONE columns
222 std::regex exp("\\d{2}-\\d{3}-\\d{3}-\\d{4}");
223 for (int64_t i = 0; i < length; i++) {
224 const char* row = phones + i * kByteWidth;
225 ASSERT_TRUE(std::regex_match(row, row + kByteWidth, exp));
226 }
227}
228
229// Verifies that each decimal is between min and max
230void VerifyDecimalsBetween(const Datum& d, int64_t min, int64_t max) {

Callers 2

VerifySupplierFunction · 0.85
VerifyCustomerFunction · 0.85

Calls 3

lengthMethod · 0.45
dataMethod · 0.45
arrayMethod · 0.45

Tested by

no test coverage detected