[Bug](array-type) Fix the core dump caused by unaligned __int128 (#11020)

Fix the core dump caused by unaligned __int128 and change DEFAULT_ALIGNMENT
This commit is contained in:
Adonis Ling
2022-07-20 16:37:27 +08:00
committed by GitHub
parent a71822a74d
commit e5663f9872
7 changed files with 83 additions and 5 deletions

View File

@ -172,4 +172,21 @@ TEST(ArrayParserTest, TestDecimalArray) {
value = {data, num_items, false, nullptr};
test_array_parser(column_pb, "[2147483647.5, \"34359738368.5\"]", value);
}
TEST(ArrayParserTest, TestFreePool) {
auto column_pb = create_column_pb("ARRAY", "DECIMAL");
MemTracker tracker(1024 * 1024, "ArrayParserTest");
MemPool mem_pool(&tracker);
FunctionContext context;
ArrayUtils::prepare_context(context, mem_pool, column_pb);
int alignment = 1;
for (int i = 1; i <= 4; ++i) {
alignment <<= 1;
auto* p = context.aligned_allocate(alignment, alignment);
EXPECT_TRUE(reinterpret_cast<uint64_t>(p) % alignment == 0);
p = context.aligned_allocate(alignment, alignment);
EXPECT_TRUE(reinterpret_cast<uint64_t>(p) % alignment == 0);
}
}
} // namespace doris