From 58b0185d3458d0b495d5e2917de78bf94ead9304 Mon Sep 17 00:00:00 2001 From: Wonchan Lee Date: Tue, 23 Feb 2021 13:55:56 -0800 Subject: [PATCH] Add a failing test case that passes a leading null to scan with skipna=False --- cpp/tests/reductions/scan_tests.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/cpp/tests/reductions/scan_tests.cpp b/cpp/tests/reductions/scan_tests.cpp index 2b7faa32316..5abcb5a6402 100644 --- a/cpp/tests/reductions/scan_tests.cpp +++ b/cpp/tests/reductions/scan_tests.cpp @@ -470,6 +470,32 @@ TYPED_TEST(ScanTest, EmptyColumnskip_nulls) CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected_col_out2, col_out->view()); } +TYPED_TEST(ScanTest, LeadingNulls) +{ + bool do_print = true; + auto const v = cudf::test::make_type_param_vector({100, 200, 300}); + auto const b = std::vector{0, 1, 1}; + cudf::test::fixed_width_column_wrapper const col_in(v.begin(), v.end(), b.begin()); + std::unique_ptr col_out; + + // expected outputs + std::vector out_v(v.size()); + std::vector out_b(v.size(), 0); + + // skipna=false + CUDF_EXPECT_NO_THROW( + col_out = + cudf::scan(col_in, cudf::make_sum_aggregation(), scan_type::INCLUSIVE, null_policy::INCLUDE)); + cudf::test::fixed_width_column_wrapper expected_col_out( + out_v.begin(), out_v.end(), out_b.begin()); + if (do_print) { + print_view(expected_col_out, "expect = "); + print_view(col_out->view(), "result = "); + } + CUDF_TEST_EXPECT_COLUMN_PROPERTIES_EQUAL(expected_col_out, col_out->view()); + CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected_col_out, col_out->view()); +} + template struct FixedPointTestBothReps : public cudf::test::BaseFixture { };