@@ -322,3 +322,61 @@ TEST_F(JoinTest, AntiJoinWithStructsAndNullsOnOneSide)
322322 auto expected = cudf::gather (left, expected_indices_col);
323323 CUDF_TEST_EXPECT_TABLES_EQUIVALENT (*expected, *result);
324324}
325+
326+ TEST_F (JoinTest, AntiJoinEmptyTables)
327+ {
328+ cudf::table empty_build_table{};
329+ cudf::table empty_probe_table{};
330+ column_wrapper<int32_t > col{0 , 1 , 2 };
331+ auto nonempty_table = cudf::table_view{{col}};
332+ // Empty build and probe tables
333+ {
334+ auto result = left_anti_join (empty_probe_table, empty_build_table, {}, {});
335+ auto expected_indices_col = column_wrapper<cudf::size_type>{};
336+ auto expected = cudf::gather (empty_probe_table, expected_indices_col);
337+ CUDF_TEST_EXPECT_TABLES_EQUIVALENT (*expected, *result);
338+ }
339+ // Empty build table
340+ {
341+ auto result = left_anti_join (nonempty_table, empty_build_table, {0 }, {});
342+ auto expected_indices_col = column_wrapper<cudf::size_type>{0 , 1 , 2 };
343+ auto expected = cudf::gather (nonempty_table, expected_indices_col);
344+ CUDF_TEST_EXPECT_TABLES_EQUIVALENT (*expected, *result);
345+ }
346+ // Empty probe table
347+ {
348+ auto result = left_anti_join (empty_probe_table, nonempty_table, {}, {0 });
349+ auto expected_indices_col = column_wrapper<cudf::size_type>{};
350+ auto expected = cudf::gather (empty_probe_table, expected_indices_col);
351+ CUDF_TEST_EXPECT_TABLES_EQUIVALENT (*expected, *result);
352+ }
353+ }
354+
355+ TEST_F (JoinTest, SemiJoinEmptyTables)
356+ {
357+ cudf::table empty_build_table{};
358+ cudf::table empty_probe_table{};
359+ column_wrapper<int32_t > col{0 , 1 , 2 };
360+ auto nonempty_table = cudf::table_view{{col}};
361+ // Empty build and probe tables
362+ {
363+ auto result = left_semi_join (empty_probe_table, empty_build_table, {}, {});
364+ auto expected_indices_col = column_wrapper<cudf::size_type>{};
365+ auto expected = cudf::gather (empty_probe_table, expected_indices_col);
366+ CUDF_TEST_EXPECT_TABLES_EQUIVALENT (*expected, *result);
367+ }
368+ // Empty build table
369+ {
370+ auto result = left_semi_join (nonempty_table, empty_build_table, {0 }, {});
371+ auto expected_indices_col = column_wrapper<cudf::size_type>{};
372+ auto expected = cudf::gather (empty_probe_table, expected_indices_col);
373+ CUDF_TEST_EXPECT_TABLES_EQUIVALENT (*expected, *result);
374+ }
375+ // Empty probe table
376+ {
377+ auto result = left_semi_join (empty_probe_table, nonempty_table, {}, {0 });
378+ auto expected_indices_col = column_wrapper<cudf::size_type>{};
379+ auto expected = cudf::gather (empty_probe_table, expected_indices_col);
380+ CUDF_TEST_EXPECT_TABLES_EQUIVALENT (*expected, *result);
381+ }
382+ }
0 commit comments