MCPcopy Create free account
hub / github.com/apache/arrow / ShouldUseCountMode

Function ShouldUseCountMode

cpp/src/arrow/compute/kernels/aggregate_mode.cc:344–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

342
343template <typename CType, typename Container>
344bool ShouldUseCountMode(const Container& values, int64_t num_valid, CType* min,
345 CType* max) {
346 // cross point to benefit from counting approach
347 // about 2x improvement for int32/64 from micro-benchmarking
348 static constexpr int kMinArraySize = 8192;
349 static constexpr int kMaxValueRange = 32768;
350
351 if (num_valid >= kMinArraySize) {
352 std::tie(*min, *max) = GetMinMax<CType>(values);
353 return static_cast<uint64_t>(*max) - static_cast<uint64_t>(*min) <= kMaxValueRange;
354 }
355 return false;
356}
357
358// pick counting or sorting approach per integers value range
359template <typename T>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected