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

Function TestOverflow

cpp/src/arrow/chunked_array_test.cc:564–586  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

562 }
563
564 void TestOverflow() {
565 const int64_t kMaxIndex = std::is_signed_v<IndexType> ? 127 : 255;
566 std::vector<IndexType> logical_index_vec = {0, 1, 2,
567 static_cast<IndexType>(kMaxIndex)};
568
569 // Overflows are rare because to make them possible, we need more chunks
570 // than logical elements in the ChunkedArray. That requires at least one
571 // empty chunk.
572 std::vector<int64_t> offsets;
573 for (int64_t i = 0; i <= kMaxIndex; i++) {
574 offsets.push_back(i);
575 }
576 ChunkResolver resolver{offsets};
577 ASSERT_OK(ResolveMany(resolver, logical_index_vec));
578
579 offsets.push_back(kMaxIndex); // adding an empty chunk
580 ChunkResolver resolver_with_empty{offsets};
581 if (sizeof(IndexType) == 1) {
582 ASSERT_NOT_OK(ResolveMany(resolver_with_empty, logical_index_vec));
583 } else {
584 ASSERT_OK(ResolveMany(resolver_with_empty, logical_index_vec));
585 }
586 }
587
588 void TestRandomInput(int32_t num_chunks, int64_t chunked_array_len) {
589 random::pcg64 rng(42);

Callers

nothing calls this directly

Calls 2

ResolveManyFunction · 0.85
push_backMethod · 0.80

Tested by

no test coverage detected