1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-04-18 21:44:02 +03:00

Fix segfault for vector scan tests on clang

This commit is contained in:
Leonid Fedorov 2022-03-25 13:08:58 +00:00
parent a646f74e37
commit c847f6ce25

View File

@ -15,9 +15,11 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#include <cstdint>
#include <iostream>
#include <gtest/gtest.h>
#include "mcs_basic_types.h"
#include "utils/common/columnwidth.h"
#include "datatypes/mcs_datatype.h"
#include "datatypes/mcs_int128.h"
@ -175,8 +177,10 @@ TEST_F(ColumnScanFilterTest, ColumnScan1ByteVectorized)
for (i = 8034; i < 8160; ++i)
EXPECT_EQ(results[i], i % 255 + 1);
EXPECT_EQ(out->Max, __col1block_cdf_umax);
EXPECT_EQ(out->Min, __col1block_cdf_umin);
datatypes::TSInt128 expectedMax(&(out->Max));
datatypes::TSInt128 expectedMin(&(out->Min));
EXPECT_EQ(expectedMax.getValue(), __col1block_cdf_umax);
EXPECT_EQ(expectedMin.getValue(), __col1block_cdf_umin);
}
TEST_F(ColumnScanFilterTest, ColumnScan2Bytes)
@ -200,8 +204,10 @@ TEST_F(ColumnScanFilterTest, ColumnScan2Bytes)
for (i = 0; i < out->NVALS; i++)
EXPECT_EQ(results[i], i);
EXPECT_EQ(out->Max, __col2block_cdf_umax);
EXPECT_EQ(out->Min, __col2block_cdf_umin);
datatypes::TSInt128 expectedMax(&(out->Max));
datatypes::TSInt128 expectedMin(&(out->Min));
EXPECT_EQ(expectedMax.getValue(), __col2block_cdf_umax);
EXPECT_EQ(expectedMin.getValue(), __col2block_cdf_umin);
}
TEST_F(ColumnScanFilterTest, ColumnScan4Bytes)
@ -224,8 +230,12 @@ TEST_F(ColumnScanFilterTest, ColumnScan4Bytes)
for (i = 0; i < out->NVALS; i++)
EXPECT_EQ(results[i], (uint32_t)i);
EXPECT_EQ(out->Max, __col4block_cdf_umax);
EXPECT_EQ(out->Min, __col4block_cdf_umin);
datatypes::TSInt128 expectedMax(&(out->Max));
datatypes::TSInt128 expectedMin(&(out->Min));
EXPECT_EQ(expectedMax.getValue(), __col4block_cdf_umax);
EXPECT_EQ(expectedMin.getValue(), __col4block_cdf_umin);
}
TEST_F(ColumnScanFilterTest, ColumnScan8Bytes)
@ -248,8 +258,11 @@ TEST_F(ColumnScanFilterTest, ColumnScan8Bytes)
for (i = 0; i < out->NVALS; i++)
ASSERT_EQ(results[i], (uint32_t)i);
EXPECT_EQ(out->Max, __col8block_cdf_umax);
EXPECT_EQ(out->Min, __col8block_cdf_umin);
datatypes::TSInt128 expectedMax(&(out->Max));
datatypes::TSInt128 expectedMin(&(out->Min));
EXPECT_EQ(expectedMax.getValue(), __col8block_cdf_umax);
EXPECT_EQ(expectedMin.getValue(), __col8block_cdf_umin);
}
TEST_F(ColumnScanFilterTest, ColumnScan2Bytes1EqFilter)
@ -280,8 +293,11 @@ TEST_F(ColumnScanFilterTest, ColumnScan2Bytes1EqFilter)
ASSERT_EQ(out->NVALS, 51);
for (i = 0; i < out->NVALS; i++)
ASSERT_EQ(results[i], i);
EXPECT_EQ(out->Max, __col2block_cdf_umax);
EXPECT_EQ(out->Min, __col2block_cdf_umin);
datatypes::TSInt128 expectedMax(&(out->Max));
datatypes::TSInt128 expectedMin(&(out->Min));
EXPECT_EQ(expectedMax.getValue(), __col2block_cdf_umax);
EXPECT_EQ(expectedMin.getValue(), __col2block_cdf_umin);
}
TEST_F(ColumnScanFilterTest, ColumnScan1ByteUsingRID)
@ -432,8 +448,11 @@ TEST_F(ColumnScanFilterTest, ColumnScan4Bytes2Filters)
ASSERT_EQ(results[i], 11 + (uint32_t)i);
}
EXPECT_EQ(out->Max, __col4block_cdf_umax);
EXPECT_EQ(out->Min, __col4block_cdf_umin);
datatypes::TSInt128 expectedMax(&(out->Max));
datatypes::TSInt128 expectedMin(&(out->Min));
EXPECT_EQ(expectedMax.getValue(), __col4block_cdf_umax);
EXPECT_EQ(expectedMin.getValue(), __col4block_cdf_umin);
}
TEST_F(ColumnScanFilterTest, ColumnScan8Bytes1EqFilter)
@ -465,8 +484,11 @@ TEST_F(ColumnScanFilterTest, ColumnScan8Bytes1EqFilter)
for (i = 0; i < out->NVALS; i++)
ASSERT_EQ(results[i], i);
EXPECT_EQ(out->Max, __col8block_cdf_umax);
EXPECT_EQ(out->Min, __col8block_cdf_umin);
datatypes::TSInt128 expectedMax(&(out->Max));
datatypes::TSInt128 expectedMin(&(out->Min));
EXPECT_EQ(expectedMax.getValue(), __col8block_cdf_umax);
EXPECT_EQ(expectedMin.getValue(), __col8block_cdf_umin);
}
TEST_F(ColumnScanFilterTest, ColumnScan8BytesUsingMultipleRIDs)
@ -533,8 +555,11 @@ TEST_F(ColumnScanFilterTest, ColumnScan8Bytes2CompFilters)
for (i = 0; i < out->NVALS; i++)
ASSERT_EQ(results[i], (uint32_t)(i < 10 ? i : i - 10 + 1001));
EXPECT_EQ(out->Max, __col8block_cdf_umax);
EXPECT_EQ(out->Min, __col8block_cdf_umin);
datatypes::TSInt128 expectedMax(&(out->Max));
datatypes::TSInt128 expectedMin(&(out->Min));
EXPECT_EQ(expectedMax.getValue(), __col8block_cdf_umax);
EXPECT_EQ(expectedMin.getValue(), __col8block_cdf_umin);
}
TEST_F(ColumnScanFilterTest, ColumnScan8Bytes2EqFilters)
@ -569,8 +594,10 @@ TEST_F(ColumnScanFilterTest, ColumnScan8Bytes2EqFilters)
ASSERT_EQ(out->NVALS, 2);
ASSERT_EQ(results[0], 10);
ASSERT_EQ(results[1], 1000);
ASSERT_EQ(out->Max, __col8block_cdf_umax);
ASSERT_EQ(out->Min, __col8block_cdf_umin);
datatypes::TSInt128 expectedMax(&(out->Max));
datatypes::TSInt128 expectedMin(&(out->Min));
ASSERT_EQ(expectedMax.getValue(), __col8block_cdf_umax);
ASSERT_EQ(expectedMin.getValue(), __col8block_cdf_umin);
}
TEST_F(ColumnScanFilterTest, ColumnScan8Bytes2EqFiltersRID)
@ -642,8 +669,11 @@ TEST_F(ColumnScanFilterTest, ColumnScan8Bytes2FiltersRIDOutputRid)
for (i = 0; i < out->NVALS; i++)
ASSERT_EQ(results[i], (i < 10 ? i : i - 10 + 1001));
ASSERT_EQ(out->Max, __col8block_cdf_umax);
ASSERT_EQ(out->Min, __col8block_cdf_umin);
datatypes::TSInt128 expectedMax(&(out->Max));
datatypes::TSInt128 expectedMin(&(out->Min));
ASSERT_EQ(expectedMax.getValue(), __col8block_cdf_umax);
ASSERT_EQ(expectedMin.getValue(), __col8block_cdf_umin);
}
TEST_F(ColumnScanFilterTest, ColumnScan8Bytes2EqFiltersRIDOutputBoth)
@ -680,8 +710,12 @@ TEST_F(ColumnScanFilterTest, ColumnScan8Bytes2EqFiltersRIDOutputBoth)
ASSERT_EQ(resultRid[i], (i < 10 ? i : i - 10 + 1001));
ASSERT_EQ(resultVal[i], (i < 10 ? i : i - 10 + 1001));
}
ASSERT_EQ(out->Max, __col8block_cdf_umax);
ASSERT_EQ(out->Min, __col8block_cdf_umin);
datatypes::TSInt128 expectedMax(&(out->Max));
datatypes::TSInt128 expectedMin(&(out->Min));
ASSERT_EQ(expectedMax.getValue(), __col8block_cdf_umax);
ASSERT_EQ(expectedMin.getValue(), __col8block_cdf_umin);
}
// void p_Col_12()
@ -926,8 +960,12 @@ TEST_F(ColumnScanFilterTest, ColumnScan16Bytes)
ASSERT_EQ(results[0], NullValue);
for (i = 1; i < out->NVALS; ++i)
ASSERT_EQ(results[i], i + 1);
EXPECT_EQ(out->Max, __col16block_cdf_umax);
EXPECT_EQ(out->Min, __col16block_cdf_umin);
datatypes::TSInt128 expectedMax(&(out->Max));
datatypes::TSInt128 expectedMin(&(out->Min));
EXPECT_EQ(expectedMax.getValue(), __col16block_cdf_umax);
EXPECT_EQ(expectedMin.getValue(), __col16block_cdf_umin);
}
TEST_F(ColumnScanFilterTest, ColumnScan16Bytes2CompFilters)
@ -962,6 +1000,9 @@ TEST_F(ColumnScanFilterTest, ColumnScan16Bytes2CompFilters)
ASSERT_EQ(results[0], 10);
ASSERT_EQ(results[1], 510);
EXPECT_EQ(out->Max, __col16block_cdf_umax);
EXPECT_EQ(out->Min, __col16block_cdf_umin);
datatypes::TSInt128 expectedMax(&(out->Max));
datatypes::TSInt128 expectedMin(&(out->Min));
EXPECT_EQ(expectedMax.getValue(), __col16block_cdf_umax);
EXPECT_EQ(expectedMin.getValue(), __col16block_cdf_umin);
}