diff --git a/cpp/tests/rolling/grouped_rolling_test.cpp b/cpp/tests/rolling/grouped_rolling_test.cpp index 72b30c19fd5..0bd88c78200 100644 --- a/cpp/tests/rolling/grouped_rolling_test.cpp +++ b/cpp/tests/rolling/grouped_rolling_test.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -2413,3 +2414,36 @@ TYPED_TEST(TypedUnboundedWindowTest, UnboundedPrecedingAndFollowingWindowMultiGr fixed_width_column_wrapper{ {3, 3, 3, 3, 3, 4, 4, 4, 4, 4}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}); } + +TYPED_TEST(TypedUnboundedWindowTest, UnboundedPrecedingAndFollowingStructGroup) +{ + // Test that grouping on STRUCT keys produces is possible. + + using cudf::test::iterators::no_nulls; + using cudf::test::iterators::nulls_at; + using T = TypeParam; + using numerics = fixed_width_column_wrapper; + using result_t = fixed_width_column_wrapper; + + auto const grp_col = [] { + auto grp_col_inner = numerics{0, 0, 0, 0, 0, 1, 1, 1, 1, 1}; + return cudf::test::structs_column_wrapper{{grp_col_inner}}; + }(); + + auto const agg_col = numerics{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, nulls_at({0, 3, 5})}; + + auto const grouping_keys = cudf::table_view{{grp_col}}; + auto const unbounded_preceding = cudf::window_bounds::unbounded(); + auto const unbounded_following = cudf::window_bounds::unbounded(); + auto const min_periods = 1L; + auto const output = + cudf::grouped_rolling_window(grouping_keys, + agg_col, + unbounded_preceding, + unbounded_following, + min_periods, + *cudf::make_count_aggregation()); + + CUDF_TEST_EXPECT_COLUMNS_EQUAL(output->view(), + result_t{{3, 3, 3, 3, 3, 4, 4, 4, 4, 4}, no_nulls()}); +}