pitrou commented on a change in pull request #8178:
URL: https://github.com/apache/arrow/pull/8178#discussion_r489252433



##########
File path: cpp/src/arrow/table_builder_test.cc
##########
@@ -151,4 +151,31 @@ TEST_F(TestRecordBatchBuilder, InvalidFieldLength) {
   ASSERT_RAISES(Invalid, builder->Flush(&dummy));
 }
 
+// In #ARROW-9969 dictionary types were not updated
+// in schema when the index width grew.
+TEST_F(TestRecordBatchBuilder, DictionaryTypes) {
+  const int num_rows = static_cast<int>(UINT8_MAX) + 2;
+  std::vector<std::string> f0_values;
+  std::vector<bool> is_valid(num_rows, true);
+  for (int i = 0; i < num_rows; i++) {
+    f0_values.push_back(std::to_string(i));
+  }
+
+  auto f0 = field("f0", dictionary(int8(), utf8()));
+
+  auto schema = ::arrow::schema({f0});
+
+  std::unique_ptr<RecordBatchBuilder> builder;
+  ASSERT_OK(RecordBatchBuilder::Make(schema, pool_, &builder));
+
+  auto b0 = builder->GetFieldAs<StringDictionaryBuilder>(0);
+
+  AppendValues<StringDictionaryBuilder, std::string>(b0, f0_values, is_valid);
+
+  std::shared_ptr<RecordBatch> batch;
+  ASSERT_OK(builder->Flush(&batch));
+
+  
ASSERT_TRUE(batch->column(0)->type()->Equals(batch->schema()->field(0)->type()));

Review comment:
       Please use `AssertTypeEqual`.




----------------------------------------------------------------
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.

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


Reply via email to