andishgar commented on code in PR #46031: URL: https://github.com/apache/arrow/pull/46031#discussion_r2053464398
########## cpp/src/arrow/record_batch_test.cc: ########## @@ -1423,37 +1453,140 @@ TEST_F(TestRecordBatch, MakeStatisticsArrayMaxApproximate) { AssertArraysEqual(*expected_statistics_array, *statistics_array, true); } -TEST_F(TestRecordBatch, MakeStatisticsArrayString) { - auto schema = - ::arrow::schema({field("no-statistics", boolean()), field("string", utf8())}); - auto no_statistics_array = ArrayFromJSON(boolean(), "[true, false, true]"); - auto string_array_data = ArrayFromJSON(utf8(), "[\"a\", null, \"c\"]")->data()->Copy(); - string_array_data->statistics = std::make_shared<ArrayStatistics>(); - string_array_data->statistics->is_max_exact = true; - string_array_data->statistics->max = "c"; - auto string_array = MakeArray(std::move(string_array_data)); - auto batch = RecordBatch::Make(schema, string_array->length(), - {no_statistics_array, string_array}); +template <typename DataType> +class TestRecordBatchMakeStatisticsArrayStringBase { + public: + std::shared_ptr<::arrow::DataType> type(int byte_width = 1) { + if constexpr (std::is_same_v<DataType, FixedSizeBinaryType>) { + return fixed_size_binary(byte_width); + } else { + return TypeTraits<DataType>::type_singleton(); + } + } + std::shared_ptr<Array> GenerateString( + const std::shared_ptr<::arrow::DataType>& dataType) { + if (dataType->id() == Type::FIXED_SIZE_BINARY) { + FixedSizeBinaryType* type = static_cast<FixedSizeBinaryType*>(dataType.get()); + int byte_width = type->byte_width(); Review Comment: I checked it — it seems that byte_width() is already available for DataType, so the following cast is redundant. -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org