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

Function TEST_P

cpp/src/arrow/compute/kernels/vector_sort_test.cc:2069–2225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2067};
2068
2069TEST_P(TestTableSortIndicesRandom, Sort) {
2070 const auto first_sort_key_name = std::get<0>(GetParam());
2071 const auto n_sort_keys = std::get<1>(GetParam());
2072 const auto null_probability = std::get<2>(GetParam());
2073 const auto nan_probability = (1.0 - null_probability) / 4;
2074 const auto seed = 0x61549225;
2075
2076 ARROW_SCOPED_TRACE("n_sort_keys = ", n_sort_keys);
2077 ARROW_SCOPED_TRACE("null_probability = ", null_probability);
2078
2079 ::arrow::random::RandomArrayGenerator rng(seed);
2080
2081 // Of these, "uint8", "boolean" and "string" should have many duplicates
2082 const FieldVector fields = {
2083 {field("uint8", uint8())},
2084 {field("int16", int16())},
2085 {field("int32", int32())},
2086 {field("uint64", uint64())},
2087 {field("float", float32())},
2088 {field("boolean", boolean())},
2089 {field("string", utf8())},
2090 {field("large_string", large_utf8())},
2091 {field("decimal128", decimal128(25, 3))},
2092 {field("decimal256", decimal256(42, 6))},
2093 };
2094 const auto schema = ::arrow::schema(fields);
2095 const int64_t length = 80;
2096
2097 using ArrayFactory = std::function<std::shared_ptr<Array>(int64_t length)>;
2098
2099 std::vector<ArrayFactory> column_factories{
2100 [&](int64_t length) { return rng.UInt8(length, 0, 10, null_probability); },
2101 [&](int64_t length) {
2102 return rng.Int16(length, -1000, 12000, /*null_probability=*/0.0);
2103 },
2104 [&](int64_t length) {
2105 return rng.Int32(length, -123456789, 987654321, null_probability);
2106 },
2107 [&](int64_t length) {
2108 return rng.UInt64(length, 1, 1234567890123456789ULL, /*null_probability=*/0.0);
2109 },
2110 [&](int64_t length) {
2111 return rng.Float32(length, -1.0f, 1.0f, null_probability, nan_probability);
2112 },
2113 [&](int64_t length) {
2114 return rng.Boolean(length, /*true_probability=*/0.3, null_probability);
2115 },
2116 [&](int64_t length) {
2117 if (length > 0) {
2118 return rng.StringWithRepeats(length, /*unique=*/1 + length / 10,
2119 /*min_length=*/5,
2120 /*max_length=*/15, null_probability);
2121 } else {
2122 return *MakeArrayOfNull(utf8(), 0);
2123 }
2124 },
2125 [&](int64_t length) {
2126 return rng.LargeString(length, /*min_length=*/5, /*max_length=*/15,

Callers 1

TESTFunction · 0.70

Calls 15

decimal256Function · 0.85
MakeArrayOfNullFunction · 0.85
factoryFunction · 0.85
ValidateFunction · 0.85
AllNullPlacementsFunction · 0.85
UInt8Method · 0.80
Int16Method · 0.80
Int32Method · 0.80
UInt64Method · 0.80
StringWithRepeatsMethod · 0.80
LargeStringMethod · 0.80

Tested by

no test coverage detected