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

Function TEST_P

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

Source from the content-addressed store, hash-verified

1963};
1964
1965TEST_P(TestTableSortIndicesRandom, Sort) {
1966 const auto first_sort_key_name = std::get<0>(GetParam());
1967 const auto n_sort_keys = std::get<1>(GetParam());
1968 const auto null_probability = std::get<2>(GetParam());
1969 const auto nan_probability = (1.0 - null_probability) / 4;
1970 const auto seed = 0x61549225;
1971
1972 ARROW_SCOPED_TRACE("n_sort_keys = ", n_sort_keys);
1973 ARROW_SCOPED_TRACE("null_probability = ", null_probability);
1974
1975 ::arrow::random::RandomArrayGenerator rng(seed);
1976
1977 // Of these, "uint8", "boolean" and "string" should have many duplicates
1978 const FieldVector fields = {
1979 {field("uint8", uint8())},
1980 {field("int16", int16())},
1981 {field("int32", int32())},
1982 {field("uint64", uint64())},
1983 {field("float", float32())},
1984 {field("boolean", boolean())},
1985 {field("string", utf8())},
1986 {field("large_string", large_utf8())},
1987 {field("decimal128", decimal128(25, 3))},
1988 {field("decimal256", decimal256(42, 6))},
1989 };
1990 const auto schema = ::arrow::schema(fields);
1991 const int64_t length = 80;
1992
1993 using ArrayFactory = std::function<std::shared_ptr<Array>(int64_t length)>;
1994
1995 std::vector<ArrayFactory> column_factories{
1996 [&](int64_t length) { return rng.UInt8(length, 0, 10, null_probability); },
1997 [&](int64_t length) {
1998 return rng.Int16(length, -1000, 12000, /*null_probability=*/0.0);
1999 },
2000 [&](int64_t length) {
2001 return rng.Int32(length, -123456789, 987654321, null_probability);
2002 },
2003 [&](int64_t length) {
2004 return rng.UInt64(length, 1, 1234567890123456789ULL, /*null_probability=*/0.0);
2005 },
2006 [&](int64_t length) {
2007 return rng.Float32(length, -1.0f, 1.0f, null_probability, nan_probability);
2008 },
2009 [&](int64_t length) {
2010 return rng.Boolean(length, /*true_probability=*/0.3, null_probability);
2011 },
2012 [&](int64_t length) {
2013 if (length > 0) {
2014 return rng.StringWithRepeats(length, /*unique=*/1 + length / 10,
2015 /*min_length=*/5,
2016 /*max_length=*/15, null_probability);
2017 } else {
2018 return *MakeArrayOfNull(utf8(), 0);
2019 }
2020 },
2021 [&](int64_t length) {
2022 return rng.LargeString(length, /*min_length=*/5, /*max_length=*/15,

Callers

nothing calls this directly

Calls 15

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

Tested by

no test coverage detected