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

Method Test

cpp/src/arrow/compute/kernels/vector_selection_test.cc:2284–2314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2282template <typename ValuesType>
2283struct TakeRandomTest {
2284 static void Test(const std::shared_ptr<DataType>& type) {
2285 ARROW_SCOPED_TRACE("type = ", *type);
2286 auto rand = random::RandomArrayGenerator(kRandomSeed);
2287 const int64_t values_length = 64 * 16 + 1;
2288 const int64_t indices_length = 64 * 4 + 1;
2289 for (const auto null_probability : {0.0, 0.001, 0.05, 0.25, 0.95, 0.999, 1.0}) {
2290 auto values = rand.ArrayOf(type, values_length, null_probability);
2291 CheckTakeRandom<ValuesType, Int8Type>(values, indices_length, null_probability,
2292 &rand);
2293 CheckTakeRandom<ValuesType, Int16Type>(values, indices_length, null_probability,
2294 &rand);
2295 CheckTakeRandom<ValuesType, Int32Type>(values, indices_length, null_probability,
2296 &rand);
2297 CheckTakeRandom<ValuesType, Int64Type>(values, indices_length, null_probability,
2298 &rand);
2299 CheckTakeRandom<ValuesType, UInt8Type>(values, indices_length, null_probability,
2300 &rand);
2301 CheckTakeRandom<ValuesType, UInt16Type>(values, indices_length, null_probability,
2302 &rand);
2303 CheckTakeRandom<ValuesType, UInt32Type>(values, indices_length, null_probability,
2304 &rand);
2305 CheckTakeRandom<ValuesType, UInt64Type>(values, indices_length, null_probability,
2306 &rand);
2307 // Sliced values array
2308 if (values_length > 2) {
2309 values = values->Slice(1, values_length - 2);
2310 CheckTakeRandom<ValuesType, UInt64Type>(values, indices_length, null_probability,
2311 &rand);
2312 }
2313 }
2314 }
2315};
2316
2317TEST(TestFilter, PrimitiveRandom) { TestRandomPrimitiveCTypes<FilterRandomTest>(); }

Callers

nothing calls this directly

Calls 2

ArrayOfMethod · 0.45
SliceMethod · 0.45

Tested by

no test coverage detected