| 527 | } |
| 528 | |
| 529 | TEST_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 | |
| 549 | TEST_F(ValueAlignment, RunEndEncoded) { |
| 550 | // Run end requires alignment, value type does not |
nothing calls this directly
no test coverage detected