| 2040 | }; |
| 2041 | |
| 2042 | TEST_P(TestTableSortIndicesRandom, Sort) { |
| 2043 | const auto first_sort_key_name = std::get<0>(GetParam()); |
| 2044 | const auto n_sort_keys = std::get<1>(GetParam()); |
| 2045 | const auto null_probability = std::get<2>(GetParam()); |
| 2046 | const auto nan_probability = (1.0 - null_probability) / 4; |
| 2047 | const auto seed = 0x61549225; |
| 2048 | |
| 2049 | ARROW_SCOPED_TRACE("n_sort_keys = ", n_sort_keys); |
| 2050 | ARROW_SCOPED_TRACE("null_probability = ", null_probability); |
| 2051 | |
| 2052 | ::arrow::random::RandomArrayGenerator rng(seed); |
| 2053 | |
| 2054 | // Of these, "uint8", "boolean" and "string" should have many duplicates |
| 2055 | const FieldVector fields = { |
| 2056 | {field("uint8", uint8())}, |
| 2057 | {field("int16", int16())}, |
| 2058 | {field("int32", int32())}, |
| 2059 | {field("uint64", uint64())}, |
| 2060 | {field("float", float32())}, |
| 2061 | {field("boolean", boolean())}, |
| 2062 | {field("string", utf8())}, |
| 2063 | {field("large_string", large_utf8())}, |
| 2064 | {field("decimal128", decimal128(25, 3))}, |
| 2065 | {field("decimal256", decimal256(42, 6))}, |
| 2066 | }; |
| 2067 | const auto schema = ::arrow::schema(fields); |
| 2068 | const int64_t length = 80; |
| 2069 | |
| 2070 | using ArrayFactory = std::function<std::shared_ptr<Array>(int64_t length)>; |
| 2071 | |
| 2072 | std::vector<ArrayFactory> column_factories{ |
| 2073 | [&](int64_t length) { return rng.UInt8(length, 0, 10, null_probability); }, |
| 2074 | [&](int64_t length) { |
| 2075 | return rng.Int16(length, -1000, 12000, /*null_probability=*/0.0); |
| 2076 | }, |
| 2077 | [&](int64_t length) { |
| 2078 | return rng.Int32(length, -123456789, 987654321, null_probability); |
| 2079 | }, |
| 2080 | [&](int64_t length) { |
| 2081 | return rng.UInt64(length, 1, 1234567890123456789ULL, /*null_probability=*/0.0); |
| 2082 | }, |
| 2083 | [&](int64_t length) { |
| 2084 | return rng.Float32(length, -1.0f, 1.0f, null_probability, nan_probability); |
| 2085 | }, |
| 2086 | [&](int64_t length) { |
| 2087 | return rng.Boolean(length, /*true_probability=*/0.3, null_probability); |
| 2088 | }, |
| 2089 | [&](int64_t length) { |
| 2090 | if (length > 0) { |
| 2091 | return rng.StringWithRepeats(length, /*unique=*/1 + length / 10, |
| 2092 | /*min_length=*/5, |
| 2093 | /*max_length=*/15, null_probability); |
| 2094 | } else { |
| 2095 | return *MakeArrayOfNull(utf8(), 0); |
| 2096 | } |
| 2097 | }, |
| 2098 | [&](int64_t length) { |
| 2099 | return rng.LargeString(length, /*min_length=*/5, /*max_length=*/15, |
nothing calls this directly
no test coverage detected