ianmcook commented on code in PR #51807:
URL: https://github.com/apache/arrow/pull/51807#discussion_r4226329407


##########
cpp/src/arrow/ipc/message_internal_test.cc:
##########
@@ -114,6 +115,29 @@ TEST(TestMessageInternal, TestEndiannessRoundtrip) {
   }
 }
 
+// GH-51779: Schema.fbs allows DictionaryEncoding.indexType to be omitted, in
+// which case the indices are signed int32.
+TEST(TestMessageInternal, DictionaryEncodingWithoutIndexType) {
+  FBB fbb;
+  auto name = fbb.CreateString("f0");
+  auto value_type = flatbuf::CreateUtf8(fbb);
+  auto encoding = flatbuf::CreateDictionaryEncoding(fbb, /*id=*/0, 
/*indexType=*/0);
+  auto fb_field = flatbuf::CreateField(fbb, name, /*nullable=*/true, 
flatbuf::Type_Utf8,
+                                       value_type.Union(), encoding);
+  auto fb_schema = flatbuf::CreateSchema(fbb, flatbuf::Endianness_Little,
+                                         fbb.CreateVector({fb_field}));
+  fbb.Finish(flatbuf::CreateMessage(fbb, flatbuf::MetadataVersion_V5,
+                                    flatbuf::MessageHeader_Schema, 
fb_schema.Union()));
+  auto metadata = Buffer::FromString(
+      std::string(reinterpret_cast<const char*>(fbb.GetBufferPointer()), 
fbb.GetSize()));

Review Comment:
   The test copies the flatbuffer into a Buffer by hand through a 
`std::string`. `internal::WriteFlatbufferBuilder(fbb)` already does this 
(`read_write_test.cc` uses it) and would also make the new `#include <string>` 
unnecessary.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to