pitrou commented on a change in pull request #6302:
URL: https://github.com/apache/arrow/pull/6302#discussion_r560207040
##########
File path: cpp/src/arrow/ipc/test_common.cc
##########
@@ -1000,6 +1003,102 @@ Status MakeDictExtension(std::shared_ptr<RecordBatch>*
out) {
return Status::OK();
}
+namespace {
+
+template <typename CValueType, typename SeedType, typename DistributionType>
+void FillRandomData(CValueType* data, size_t n, CValueType min, CValueType max,
+ SeedType seed) {
+ std::default_random_engine rng(seed);
+ DistributionType dist(min, max);
+ std::generate(data, data + n,
+ [&dist, &rng] { return static_cast<CValueType>(dist(rng)); });
+}
+
+template <typename CValueType, typename SeedType>
+enable_if_t<std::is_integral<CValueType>::value &&
std::is_signed<CValueType>::value,
+ void>
+FillRandomData(CValueType* data, size_t n, SeedType seed) {
+ FillRandomData<CValueType, SeedType,
std::uniform_int_distribution<CValueType>>(
+ data, n, 0, 1000, seed);
+}
+
+template <typename CValueType, typename SeedType>
+enable_if_t<std::is_integral<CValueType>::value &&
std::is_unsigned<CValueType>::value,
+ void>
+FillRandomData(CValueType* data, size_t n, SeedType seed) {
+ FillRandomData<CValueType, SeedType,
std::uniform_int_distribution<CValueType>>(
+ data, n, -1000, 1000, seed);
Review comment:
This is what I said: you're using a negative value in a function
specialized for unsigned ints... WIll change.
----------------------------------------------------------------
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]