Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove static column vectors from window function tests. #18099

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions cpp/tests/rolling/offset_row_window_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2024, NVIDIA CORPORATION.
* Copyright (c) 2021-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -43,18 +43,21 @@ auto constexpr null = int32_t{0}; // NULL representation for int32_t;
auto no_nulls_list() { return nulls_at({}); }

struct OffsetRowWindowTest : public cudf::test::BaseFixture {
static ints_column const _keys; // {0, 0, 0, 0, 0, 0, 1, 1, 1, 1};
static ints_column const _values; // {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};

struct rolling_runner {
cudf::window_bounds _preceding, _following;
cudf::size_type _min_periods;
bool _grouped = true;
ints_column const _keys; // {0, 0, 0, 0, 0, 0, 1, 1, 1, 1};
ints_column const _values; // {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};

rolling_runner(cudf::window_bounds const& preceding,
cudf::window_bounds const& following,
cudf::size_type min_periods_ = 1)
: _preceding{preceding}, _following{following}, _min_periods{min_periods_}
: _preceding{preceding},
_following{following},
_min_periods{min_periods_},
_keys{0, 0, 0, 0, 0, 0, 1, 1, 1, 1},
_values{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
{
}

Expand All @@ -80,9 +83,6 @@ struct OffsetRowWindowTest : public cudf::test::BaseFixture {
};
};

ints_column const OffsetRowWindowTest::_keys{0, 0, 0, 0, 0, 0, 1, 1, 1, 1};
ints_column const OffsetRowWindowTest::_values{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};

auto const AGG_COUNT_NON_NULL =
cudf::make_count_aggregation<cudf::rolling_aggregation>(cudf::null_policy::EXCLUDE);
auto const AGG_COUNT_ALL =
Expand All @@ -96,7 +96,8 @@ TEST_F(OffsetRowWindowTest, OffsetRowWindow_Grouped_3_to_Minus_1)
{
auto const preceding = cudf::window_bounds::get(3);
auto const following = cudf::window_bounds::get(-1);
auto run_rolling = rolling_runner{preceding, following}.min_periods(1).grouped(true);
auto run_rolling = rolling_runner{preceding, following};
run_rolling.min_periods(1).grouped(true);

CUDF_TEST_EXPECT_COLUMNS_EQUAL(*run_rolling(*AGG_COUNT_NON_NULL),
ints_column{{0, 1, 2, 2, 2, 2, 0, 1, 2, 2}, nulls_at({0, 6})});
Expand Down Expand Up @@ -136,7 +137,8 @@ TEST_F(OffsetRowWindowTest, OffsetRowWindow_Ungrouped_3_to_Minus_1)
{
auto const preceding = cudf::window_bounds::get(3);
auto const following = cudf::window_bounds::get(-1);
auto run_rolling = rolling_runner{preceding, following}.min_periods(1).grouped(false);
auto run_rolling = rolling_runner{preceding, following};
run_rolling.min_periods(1).grouped(false);

CUDF_TEST_EXPECT_COLUMNS_EQUAL(*run_rolling(*AGG_COUNT_NON_NULL),
ints_column{{0, 1, 2, 2, 2, 2, 2, 2, 2, 2}, nulls_at({0})});
Expand Down Expand Up @@ -176,7 +178,8 @@ TEST_F(OffsetRowWindowTest, OffsetRowWindow_Grouped_0_to_2)
{
auto const preceding = cudf::window_bounds::get(0);
auto const following = cudf::window_bounds::get(2);
auto run_rolling = rolling_runner{preceding, following}.min_periods(1).grouped(true);
auto run_rolling = rolling_runner{preceding, following};
run_rolling.min_periods(1).grouped(true);

CUDF_TEST_EXPECT_COLUMNS_EQUAL(
*run_rolling(*AGG_COUNT_NON_NULL),
Expand Down Expand Up @@ -219,7 +222,8 @@ TEST_F(OffsetRowWindowTest, OffsetRowWindow_Ungrouped_0_to_2)
{
auto const preceding = cudf::window_bounds::get(0);
auto const following = cudf::window_bounds::get(2);
auto run_rolling = rolling_runner{preceding, following}.min_periods(1).grouped(false);
auto run_rolling = rolling_runner{preceding, following};
run_rolling.min_periods(1).grouped(false);

CUDF_TEST_EXPECT_COLUMNS_EQUAL(*run_rolling(*AGG_COUNT_NON_NULL),
ints_column{{2, 2, 2, 2, 2, 2, 2, 2, 1, null}, nulls_at({9})});
Expand Down
Loading