Skip to content

Commit c0a2dc7

Browse files
GH-48151: [C++][Parquet] Fix arrow-ipc-message-internal-test failure
1 parent 7d11484 commit c0a2dc7

File tree

1 file changed

+36
-32
lines changed

1 file changed

+36
-32
lines changed

cpp/src/arrow/ipc/message_internal_test.cc

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -41,41 +41,45 @@ using FBB = flatbuffers::FlatBufferBuilder;
4141
TEST(TestMessageInternal, TestByteIdentical) {
4242
DictionaryFieldMapper mapper;
4343

44-
// Create a simple Schema with just two metadata KVPs
45-
auto f0 = field("f0", int64());
46-
auto f1 = field("f1", int64());
47-
std::vector<std::shared_ptr<Field>> fields = {f0, f1};
48-
std::shared_ptr<KeyValueMetadata> metadata =
49-
KeyValueMetadata::Make({"key_1", "key_2"}, {"key_1_value", "key_2_value"});
50-
auto schema = ::arrow::schema({f0}, metadata);
44+
for (const auto endianness : {Endianness::Little}) {
45+
// Create a simple Schema with just two metadata KVPs
46+
auto f0 = field("f0", int64());
47+
auto f1 = field("f1", int64());
48+
std::vector<std::shared_ptr<Field>> fields = {f0, f1};
49+
std::shared_ptr<KeyValueMetadata> metadata =
50+
KeyValueMetadata::Make({"key_1", "key_2"}, {"key_1_value", "key_2_value"});
51+
auto schema = ::arrow::schema({f0}, endianness, metadata);
5152

52-
// Serialize the Schema to a Buffer
53-
std::shared_ptr<Buffer> out_buffer;
54-
ASSERT_OK(
55-
WriteSchemaMessage(*schema, mapper, IpcWriteOptions::Defaults(), &out_buffer));
53+
// Serialize the Schema to a Buffer
54+
std::shared_ptr<Buffer> out_buffer;
55+
ASSERT_OK(
56+
WriteSchemaMessage(*schema, mapper, IpcWriteOptions::Defaults(), &out_buffer));
57+
58+
// This is example output from macOS+ARM+LLVM
59+
const uint8_t expected[] = {
60+
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x0E, 0x00, 0x06, 0x00, 0x05,
61+
0x00, 0x08, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x10, 0x00,
62+
0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08,
63+
0x00, 0x0A, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
64+
0x02, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xD8,
65+
0xFF, 0xFF, 0xFF, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0B, 0x00,
66+
0x00, 0x00, 0x6B, 0x65, 0x79, 0x5F, 0x32, 0x5F, 0x76, 0x61, 0x6C, 0x75, 0x65,
67+
0x00, 0x05, 0x00, 0x00, 0x00, 0x6B, 0x65, 0x79, 0x5F, 0x32, 0x00, 0x00, 0x00,
68+
0x08, 0x00, 0x0C, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x18,
69+
0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x6B, 0x65,
70+
0x79, 0x5F, 0x31, 0x5F, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x00, 0x05, 0x00, 0x00,
71+
0x00, 0x6B, 0x65, 0x79, 0x5F, 0x31, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
72+
0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x14, 0x00, 0x08, 0x00, 0x06, 0x00, 0x07,
73+
0x00, 0x0C, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
74+
0x01, 0x02, 0x10, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
75+
0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x66, 0x30, 0x00, 0x00,
76+
0x08, 0x00, 0x0C, 0x00, 0x08, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
77+
0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00};
5678

57-
// This is example output from macOS+ARM+LLVM
58-
const uint8_t expected[] = {
59-
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x0E, 0x00, 0x06, 0x00, 0x05, 0x00,
60-
0x08, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x10, 0x00, 0x00, 0x00,
61-
0x00, 0x00, 0x0A, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0A, 0x00,
62-
0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
63-
0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xD8, 0xFF, 0xFF, 0xFF, 0x18, 0x00,
64-
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x6B, 0x65, 0x79, 0x5F,
65-
0x32, 0x5F, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x00, 0x05, 0x00, 0x00, 0x00, 0x6B, 0x65,
66-
0x79, 0x5F, 0x32, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x04, 0x00, 0x08, 0x00,
67-
0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0B, 0x00,
68-
0x00, 0x00, 0x6B, 0x65, 0x79, 0x5F, 0x31, 0x5F, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x00,
69-
0x05, 0x00, 0x00, 0x00, 0x6B, 0x65, 0x79, 0x5F, 0x31, 0x00, 0x00, 0x00, 0x01, 0x00,
70-
0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x14, 0x00, 0x08, 0x00, 0x06, 0x00,
71-
0x07, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
72-
0x01, 0x02, 0x10, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
73-
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x66, 0x30, 0x00, 0x00, 0x08, 0x00,
74-
0x0C, 0x00, 0x08, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
75-
0x40, 0x00, 0x00, 0x00};
76-
Buffer expected_buffer(expected, sizeof(expected));
79+
Buffer expected_buffer(expected, sizeof(expected));
7780

78-
AssertBufferEqual(expected_buffer, *out_buffer);
81+
AssertBufferEqual(expected_buffer, *out_buffer);
82+
}
7983
}
8084

8185
TEST(TestMessageInternal, TestEndiannessRoundtrip) {

0 commit comments

Comments
 (0)