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

Function TEST_F

cpp/src/arrow/util/align_util_test.cc:529–547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

527}
528
529TEST_F(ValueAlignment, DenseUnion) {
530 std::shared_ptr<ArrayData> data = SampleArray<DenseUnionType>();
531 ASSERT_TRUE(util::CheckAlignment(*data, util::kValueAlignment));
532
533 std::shared_ptr<ArrayData> unaligned = UnalignBuffers(*data);
534 ASSERT_FALSE(util::CheckAlignment(*unaligned, util::kValueAlignment));
535 // Dense union arrays are the only array type where the buffer at index 2 is expected
536 // to be aligned (it contains 32-bit offsets and should be 4-byte aligned)
537 ASSERT_FALSE(util::CheckAlignment(*unaligned->buffers[2], 4));
538
539 ASSERT_OK_AND_ASSIGN(
540 std::shared_ptr<ArrayData> realigned,
541 util::EnsureAlignment(unaligned, util::kValueAlignment, default_memory_pool()));
542
543 ASSERT_TRUE(util::CheckAlignment(*realigned, util::kValueAlignment));
544 ASSERT_TRUE(util::CheckAlignment(*realigned->buffers[2], 4));
545 // The buffer at index 1 is the types buffer which does not require realignment
546 ASSERT_EQ(unaligned->buffers[1]->data(), realigned->buffers[1]->data());
547}
548
549TEST_F(ValueAlignment, RunEndEncoded) {
550 // Run end requires alignment, value type does not

Callers

nothing calls this directly

Calls 12

UnalignBuffersFunction · 0.85
EnsureAlignmentFunction · 0.85
default_memory_poolFunction · 0.85
ArrayFromJSONFunction · 0.85
ExampleSmallintFunction · 0.85
CheckModifiedMethod · 0.80
CheckUnmodifiedMethod · 0.80
CheckAlignmentFunction · 0.70
ASSERT_OK_AND_ASSIGNFunction · 0.70
MakeFunction · 0.70
dictionaryFunction · 0.50
dataMethod · 0.45

Tested by

no test coverage detected