From 5489eb48c4dd607737f47aba3d2a5a582f5e96e4 Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Tue, 19 Mar 2024 17:50:45 +0000 Subject: [PATCH] fix: any() on empty set now correctly returns False --- bigframes/core/compile/aggregate_compiler.py | 2 +- tests/system/small/test_index.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bigframes/core/compile/aggregate_compiler.py b/bigframes/core/compile/aggregate_compiler.py index 7059c4fdc1..9c1db0f162 100644 --- a/bigframes/core/compile/aggregate_compiler.py +++ b/bigframes/core/compile/aggregate_compiler.py @@ -414,7 +414,7 @@ def _( result = _is_true(column).any() return cast( ibis_types.BooleanScalar, - _apply_window_if_present(result, window).fillna(ibis_types.literal(True)), + _apply_window_if_present(result, window).fillna(ibis_types.literal(False)), ) diff --git a/tests/system/small/test_index.py b/tests/system/small/test_index.py index 2961884ebf..1f39ba25fe 100644 --- a/tests/system/small/test_index.py +++ b/tests/system/small/test_index.py @@ -68,6 +68,10 @@ def test_index_has_duplicates(scalars_df_index, scalars_pandas_df_index): assert bf_result == pd_result +def test_index_empty_has_duplicates(): + assert not bpd.Index([]).has_duplicates + + def test_index_values(scalars_df_index, scalars_pandas_df_index): bf_result = scalars_df_index.index.values pd_result = scalars_pandas_df_index.index.values