Skip to content
This repository was archived by the owner on May 10, 2024. It is now read-only.

Commit 13e82fc

Browse files
author
Deepak Majeti
committed
fix failures
1 parent 5acdada commit 13e82fc

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

src/parquet/parquet_reader_writer-test.cc

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -239,25 +239,26 @@ void TestStatistics<ByteArrayType>::AddNodes(std::string name) {
239239

240240
template <>
241241
void TestStatistics<ByteArrayType>::SetValues() {
242-
int max_byte_array_len = 4;
242+
int max_byte_array_len = 10;
243243
size_t nbytes = NUM_VALUES * max_byte_array_len;
244244
values_buf_.resize(nbytes);
245245
std::vector<std::string> vals = {u8"c123", u8"b123", u8"a123", u8"d123", u8"e123",
246246
u8"f123", u8"g123", u8"h123", u8"i123", u8"ü123"};
247247

248+
uint8_t* base = &values_buf_.data()[0];
248249
for (int i = 0; i < NUM_VALUES; i++) {
249-
uint8_t* base = &values_buf_.data()[0] + (i * max_byte_array_len);
250-
memcpy(base, vals[i].c_str(), max_byte_array_len);
250+
memcpy(base, vals[i].c_str(), vals[i].length());
251251
values_[i].ptr = base;
252-
values_[i].len = max_byte_array_len;
252+
values_[i].len = static_cast<uint32_t>(vals[i].length());
253+
base += vals[i].length();
253254
}
254255

255256
// Write String min/max values
256257
stats_[0]
257258
.set_min(
258-
std::string(reinterpret_cast<const char*>(vals[2].c_str()), max_byte_array_len))
259+
std::string(reinterpret_cast<const char*>(vals[2].c_str()), vals[2].length()))
259260
.set_max(std::string(reinterpret_cast<const char*>(vals[9].c_str()),
260-
max_byte_array_len));
261+
vals[9].length()));
261262
}
262263

263264
// TYPE::FLBAArray
@@ -273,22 +274,23 @@ template <>
273274
void TestStatistics<FLBAType>::SetValues() {
274275
size_t nbytes = NUM_VALUES * FLBA_LENGTH;
275276
values_buf_.resize(nbytes);
276-
std::vector<std::string> vals = {u8"b12345", u8"aü123456789", u8"c123", u8"d123",
277-
u8"e123", u8"f123", u8"g123", u8"h123",
278-
u8"üa123", u8"üa123456789"};
277+
char vals[NUM_VALUES][FLBA_LENGTH] = {"b12345", "a12345", "c12345", "d12345",
278+
"e12345", "f12345", "g12345", "h12345",
279+
"z12345", "a12345"};
279280

281+
uint8_t* base = &values_buf_.data()[0];
280282
for (int i = 0; i < NUM_VALUES; i++) {
281-
uint8_t* base = &values_buf_.data()[0] + (i * FLBA_LENGTH);
282-
memcpy(base, vals[i].c_str(), vals[i].length());
283+
memcpy(base, &vals[i][0], FLBA_LENGTH);
283284
values_[i].ptr = base;
285+
base += FLBA_LENGTH;
284286
}
285287

286288
// Write FLBA min,max values
287289
stats_[0]
288290
.set_min(
289-
std::string(reinterpret_cast<const char*>(vals[1].c_str()), vals[1].length()))
291+
std::string(reinterpret_cast<const char*>(&vals[1][0]), FLBA_LENGTH))
290292
.set_max(
291-
std::string(reinterpret_cast<const char*>(vals[9].c_str()), vals[9].length()));
293+
std::string(reinterpret_cast<const char*>(&vals[8][0]), FLBA_LENGTH));
292294
}
293295

294296
TYPED_TEST_CASE(TestStatistics, TestTypes);

src/parquet/parquet_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
// define the parquet created by version
2222
#define CREATED_BY_VERSION "parquet-cpp version 1.2.1-SNAPSHOT"
2323

24-
#endif // PARQUET_VERSION_H
24+
#endif // PARQUET_VERSION_H

src/parquet/util/comparison-test.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
#include "parquet/types.h"
2626
#include "parquet/util/comparison.h"
2727

28+
#if defined(_MSC_VER)
29+
#pragma execution_character_set("utf-8")
30+
#endif
31+
2832
namespace parquet {
2933

3034
namespace test {
@@ -78,13 +82,13 @@ TEST(Comparison, UnsignedByteArray) {
7882
ByteArray s2ba = ByteArrayFromString(s2);
7983
ASSERT_TRUE(uless(s1ba, s2ba));
8084

85+
// Multi-byte UTF-8 characters
8186
s1 = u8"braten";
8287
s2 = u8"bügeln";
8388
s1ba = ByteArrayFromString(s1);
8489
s2ba = ByteArrayFromString(s2);
8590
ASSERT_TRUE(uless(s1ba, s2ba));
8691

87-
// Multi-byte UTF-8 characters
8892
s1 = u8"ünk123456"; // ü = 252
8993
s2 = u8"ănk123456"; // ă = 259
9094
s1ba = ByteArrayFromString(s1);

0 commit comments

Comments
 (0)