cpp/src/arrow/table_builder_test.cc
// In #ARROW-9969 dictionary types were not updated
// in schema when the index width grew.
In #ARROW-9969 dictionary types were not updated
in schema when the index width grew.
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));
  AssertTypeEqual(batch->column(0)->type(), batch->schema()->field(0)->type());
}
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 ( " " , 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 ) ) ; AssertTypeEqual ( batch -> column ( 0 ) -> type ( ) , batch -> schema ( ) -> field ( 0 ) -> type ( ) ) ; }
In #ARROW-9969 dictionary types were not updated
in schema when the index width grew.
In #ARROW - 9969 dictionary types were not updated in schema when the index width grew .