Skip to content

Commit 38e37fb

Browse files
authored
fix(ut): fix more ut under gcc8 (#67)
1 parent 95940ad commit 38e37fb

16 files changed

+743
-502
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,10 @@ if(PAIMON_BUILD_TESTS)
309309
message(FATAL_ERROR "PAIMON_ENABLE_ORC must be enabled if PAIMON_BUILD_TESTS is enable"
310310
)
311311
endif()
312+
if(NOT PAIMON_ENABLE_AVRO)
313+
message(FATAL_ERROR "PAIMON_ENABLE_AVRO must be enabled if PAIMON_BUILD_TESTS is enable"
314+
)
315+
endif()
312316
# Adding unit tests part of the "paimon" portion of the test suite
313317
add_custom_target(paimon-tests)
314318
build_gtest()

src/paimon/core/io/field_mapping_reader_test.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <map>
2020
#include <ostream>
21+
#include <string>
2122
#include <utility>
2223
#include <variant>
2324

@@ -227,7 +228,7 @@ TEST_F(FieldMappingReaderTest, TestGenerateSinglePartitionArray) {
227228
/*non_exist_field_info=*/std::nullopt);
228229
auto partition = BinaryRowGenerator::GenerateRow(
229230
{false, static_cast<int8_t>(1), static_cast<int16_t>(2), static_cast<int32_t>(3),
230-
static_cast<int64_t>(4), static_cast<float>(5.1), 6.21, "7",
231+
static_cast<int64_t>(4), static_cast<float>(5.1), 6.21, std::string("7"),
231232
std::make_shared<Bytes>("8", pool_.get()), 100},
232233
pool_.get());
233234
auto mapping_reader = std::make_unique<FieldMappingReader>(

src/paimon/core/manifest/manifest_file_test.cpp

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <functional>
2020
#include <map>
2121
#include <optional>
22+
#include <string>
2223
#include <utility>
2324
#include <variant>
2425

@@ -85,7 +86,8 @@ TEST_F(ManifestFileTest, TestSimple) {
8586
"data-4e30d6c0-f109-4300-a010-4ba03047dd9d-0.orc", /*file_size=*/575, /*row_count=*/3,
8687
/*min_key=*/BinaryRow::EmptyRow(), /*max_key=*/BinaryRow::EmptyRow(),
8788
/*key_stats=*/SimpleStats::EmptyStats(),
88-
BinaryRowGenerator::GenerateStats({"Bob", 10, 0, 12.1}, {"Tony", 10, 0, 14.1}, {0, 0, 0, 0},
89+
BinaryRowGenerator::GenerateStats({std::string("Bob"), 10, 0, 12.1},
90+
{std::string("Tony"), 10, 0, 14.1}, {0, 0, 0, 0},
8991
pool.get()),
9092
/*min_sequence_number=*/0, /*max_sequence_number=*/2, /*schema_id=*/0,
9193
/*level=*/0, /*extra_files=*/std::vector<std::optional<std::string>>(),
@@ -102,8 +104,9 @@ TEST_F(ManifestFileTest, TestSimple) {
102104
"data-10b9eea8-241d-4e4b-8ab8-2a82d72d79a2-0.orc", /*file_size=*/589, /*row_count=*/3,
103105
/*min_key=*/BinaryRow::EmptyRow(), /*max_key=*/BinaryRow::EmptyRow(),
104106
/*key_stats=*/SimpleStats::EmptyStats(),
105-
BinaryRowGenerator::GenerateStats({"Alex", 10, 0, 12.1}, {"Emily", 10, 0, 16.1},
106-
{0, 0, 0, 0}, pool.get()),
107+
BinaryRowGenerator::GenerateStats({std::string("Alex"), 10, 0, 12.1},
108+
{std::string("Emily"), 10, 0, 16.1}, {0, 0, 0, 0},
109+
pool.get()),
107110
/*min_sequence_number=*/3, /*max_sequence_number=*/5, /*schema_id=*/0,
108111
/*level=*/0, /*extra_files=*/std::vector<std::optional<std::string>>(),
109112
/*creation_time=*/Timestamp(1721643267385ll, 0),
@@ -119,8 +122,9 @@ TEST_F(ManifestFileTest, TestSimple) {
119122
"data-e2bb59ee-ae25-4e5b-9bcc-257250bc5fdd-0.orc", /*file_size=*/541, /*row_count=*/1,
120123
/*min_key=*/BinaryRow::EmptyRow(), /*max_key=*/BinaryRow::EmptyRow(),
121124
/*key_stats=*/SimpleStats::EmptyStats(),
122-
BinaryRowGenerator::GenerateStats({"David", 10, 0, 17.1}, {"David", 10, 0, 17.1},
123-
{0, 0, 0, 0}, pool.get()),
125+
BinaryRowGenerator::GenerateStats({std::string("David"), 10, 0, 17.1},
126+
{std::string("David"), 10, 0, 17.1}, {0, 0, 0, 0},
127+
pool.get()),
124128
/*min_sequence_number=*/6, /*max_sequence_number=*/6, /*schema_id=*/0,
125129
/*level=*/0, /*extra_files=*/std::vector<std::optional<std::string>>(),
126130
/*creation_time=*/Timestamp(1721643314161ll, 0),
@@ -136,8 +140,9 @@ TEST_F(ManifestFileTest, TestSimple) {
136140
"data-2d5ea1ea-77c1-47ff-bb87-19a509962a37-0.orc", /*file_size=*/538, /*row_count=*/1,
137141
/*min_key=*/BinaryRow::EmptyRow(), /*max_key=*/BinaryRow::EmptyRow(),
138142
/*key_stats=*/SimpleStats::EmptyStats(),
139-
BinaryRowGenerator::GenerateStats({"Lily", 10, 0, 17.1}, {"Lily", 10, 0, 17.1},
140-
{0, 0, 0, 0}, pool.get()),
143+
BinaryRowGenerator::GenerateStats({std::string("Lily"), 10, 0, 17.1},
144+
{std::string("Lily"), 10, 0, 17.1}, {0, 0, 0, 0},
145+
pool.get()),
141146
/*min_sequence_number=*/7, /*max_sequence_number=*/7, /*schema_id=*/0,
142147
/*level=*/0, /*extra_files=*/std::vector<std::optional<std::string>>(),
143148
/*creation_time=*/Timestamp(1721643834400ll, 0),
@@ -153,8 +158,9 @@ TEST_F(ManifestFileTest, TestSimple) {
153158
"data-b9e7c41f-66e8-4dad-b25a-e6e1963becc4-0.orc", /*file_size=*/640, /*row_count=*/8,
154159
/*min_key=*/BinaryRow::EmptyRow(), /*max_key=*/BinaryRow::EmptyRow(),
155160
/*key_stats=*/SimpleStats::EmptyStats(),
156-
BinaryRowGenerator::GenerateStats({"Alex", 10, 0, 12.1}, {"Tony", 10, 0, 17.1},
157-
{0, 0, 0, 0}, pool.get()),
161+
BinaryRowGenerator::GenerateStats({std::string("Alex"), 10, 0, 12.1},
162+
{std::string("Tony"), 10, 0, 17.1}, {0, 0, 0, 0},
163+
pool.get()),
158164
/*min_sequence_number=*/0, /*max_sequence_number=*/7, /*schema_id=*/0,
159165
/*level=*/0, /*extra_files=*/std::vector<std::optional<std::string>>(),
160166
/*creation_time=*/Timestamp(1721643834472ll, 0),
@@ -185,8 +191,9 @@ TEST_F(ManifestFileTest, TestWithNullCount) {
185191
"data-10b9eea8-241d-4e4b-8ab8-2a82d72d79a2-0.orc", /*file_size=*/589, /*row_count=*/3,
186192
/*min_key=*/BinaryRow::EmptyRow(), /*max_key=*/BinaryRow::EmptyRow(),
187193
/*key_stats=*/SimpleStats::EmptyStats(),
188-
BinaryRowGenerator::GenerateStats({"Alex", 10, 0, 12.1}, {"Emily", 10, 0, 16.1},
189-
{0, 0, 0, 0}, pool.get()),
194+
BinaryRowGenerator::GenerateStats({std::string("Alex"), 10, 0, 12.1},
195+
{std::string("Emily"), 10, 0, 16.1}, {0, 0, 0, 0},
196+
pool.get()),
190197
/*min_sequence_number=*/3, /*max_sequence_number=*/5, /*schema_id=*/0,
191198
/*level=*/0, /*extra_files=*/std::vector<std::optional<std::string>>(),
192199
/*creation_time=*/Timestamp(1721643267385ll, 0),
@@ -211,8 +218,9 @@ TEST_F(ManifestFileTest, TestWithNullCount) {
211218
"data-b913a160-a4d1-4084-af2a-18333c35668e-0.orc", /*file_size=*/506, /*row_count=*/1,
212219
/*min_key=*/BinaryRow::EmptyRow(), /*max_key=*/BinaryRow::EmptyRow(),
213220
/*key_stats=*/SimpleStats::EmptyStats(),
214-
BinaryRowGenerator::GenerateStats({"Paul", 20, 1, NullType()}, {"Paul", 20, 1, NullType()},
215-
{0, 0, 0, 1}, pool.get()),
221+
BinaryRowGenerator::GenerateStats({std::string("Paul"), 20, 1, NullType()},
222+
{std::string("Paul"), 20, 1, NullType()}, {0, 0, 0, 1},
223+
pool.get()),
216224
/*min_sequence_number=*/1, /*max_sequence_number=*/1, /*schema_id=*/0,
217225
/*level=*/0, /*extra_files=*/std::vector<std::optional<std::string>>(),
218226
/*creation_time=*/Timestamp(1721643267404ll, 0),
@@ -241,13 +249,14 @@ TEST_F(ManifestFileTest, TestManifestFileCompatibleWithJavaPaimon09) {
241249
::paimon::test::BinaryRowGenerator::GenerateStats(
242250
{false, static_cast<int8_t>(-128), static_cast<int16_t>(-32768),
243251
static_cast<int32_t>(-2147483648), -9999999999999, -1234.56f, -1234567890.0987654321,
244-
"aa", NullType(), NullType(), NullType(), TimestampType(Timestamp(123123, 123000), 9),
245-
2456, Decimal(2, 2, -22), Decimal(10, 10, -1234567890),
246-
Decimal(19, 19, 1234567890987654321)},
252+
std::string("aa"), NullType(), NullType(), NullType(),
253+
TimestampType(Timestamp(123123, 123000), 9), 2456, Decimal(2, 2, -22),
254+
Decimal(10, 10, -1234567890), Decimal(19, 19, 1234567890987654321)},
247255
{true, static_cast<int8_t>(127), static_cast<int16_t>(32767),
248-
static_cast<int32_t>(2147483647), 9999999999999, 1234.56f, 1234567890.0987654321, "aa",
249-
NullType(), NullType(), NullType(), TimestampType(Timestamp(999999, 999000), 9), 2456,
250-
Decimal(2, 2, 22), Decimal(10, 10, 1234567890), Decimal(19, 19, 1234567890987654321)},
256+
static_cast<int32_t>(2147483647), 9999999999999, 1234.56f, 1234567890.0987654321,
257+
std::string("aa"), NullType(), NullType(), NullType(),
258+
TimestampType(Timestamp(999999, 999000), 9), 2456, Decimal(2, 2, 22),
259+
Decimal(10, 10, 1234567890), Decimal(19, 19, 1234567890987654321)},
251260
{1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 2}, pool.get()),
252261
/*min_sequence_number=*/0, /*max_sequence_number=*/2, /*schema_id=*/0,
253262
/*level=*/0, /*extra_files=*/std::vector<std::optional<std::string>>(),
@@ -276,13 +285,14 @@ TEST_F(ManifestFileTest, TestManifestFileCompatibleWithJavaPaimon11) {
276285
::paimon::test::BinaryRowGenerator::GenerateStats(
277286
{false, static_cast<int8_t>(-128), static_cast<int16_t>(-32768),
278287
static_cast<int32_t>(-2147483648), -9999999999999, -1234.56f, -1234567890.0987654321,
279-
"aa", NullType(), NullType(), NullType(), TimestampType(Timestamp(123123, 123000), 9),
280-
2456, Decimal(2, 2, -22), Decimal(10, 10, -1234567890),
281-
Decimal(19, 19, 1234567890987654321)},
288+
std::string("aa"), NullType(), NullType(), NullType(),
289+
TimestampType(Timestamp(123123, 123000), 9), 2456, Decimal(2, 2, -22),
290+
Decimal(10, 10, -1234567890), Decimal(19, 19, 1234567890987654321)},
282291
{true, static_cast<int8_t>(127), static_cast<int16_t>(32767),
283-
static_cast<int32_t>(2147483647), 9999999999999, 1234.56f, 1234567890.0987654321, "aa",
284-
NullType(), NullType(), NullType(), TimestampType(Timestamp(999999, 999000), 9), 2456,
285-
Decimal(2, 2, 22), Decimal(10, 10, 1234567890), Decimal(19, 19, 1234567890987654321)},
292+
static_cast<int32_t>(2147483647), 9999999999999, 1234.56f, 1234567890.0987654321,
293+
std::string("aa"), NullType(), NullType(), NullType(),
294+
TimestampType(Timestamp(999999, 999000), 9), 2456, Decimal(2, 2, 22),
295+
Decimal(10, 10, 1234567890), Decimal(19, 19, 1234567890987654321)},
286296
{1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 2}, pool.get()),
287297
/*min_sequence_number=*/0, /*max_sequence_number=*/2, /*schema_id=*/0,
288298
/*level=*/0, /*extra_files=*/std::vector<std::optional<std::string>>(),

0 commit comments

Comments
 (0)