This repository was archived by the owner on Apr 1, 2026. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
tests/system/large/functions Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 2525import typing
2626from typing import (
2727 Any ,
28+ Callable ,
2829 cast ,
2930 Iterable ,
3031 List ,
@@ -2330,7 +2331,7 @@ def _throw_if_index_contains_duplicates(
23302331
23312332 def map (
23322333 self ,
2333- arg : typing .Union [Mapping , Series ],
2334+ arg : typing .Union [Mapping , Series , Callable ],
23342335 na_action : Optional [str ] = None ,
23352336 * ,
23362337 verify_integrity : bool = False ,
@@ -2352,6 +2353,7 @@ def map(
23522353 )
23532354 map_df = map_df .set_index ("keys" )
23542355 elif callable (arg ):
2356+ # This is for remote function and managed funtion.
23552357 return self .apply (arg )
23562358 else :
23572359 # Mirroring pandas, call the uncallable object
Original file line number Diff line number Diff line change @@ -1245,7 +1245,7 @@ def the_sum(s):
12451245 cleanup_function_assets (the_sum_mf , session .bqclient , ignore_failures = False )
12461246
12471247
1248- def test_managed_function_series_where_mask (session , dataset_id , scalars_dfs ):
1248+ def test_managed_function_series_where_mask_map (session , dataset_id , scalars_dfs ):
12491249 try :
12501250
12511251 # The return type has to be bool type for callable where condition.
@@ -1286,6 +1286,13 @@ def _is_positive(s):
12861286 # Ignore any dtype difference.
12871287 pandas .testing .assert_series_equal (bf_result , pd_result , check_dtype = False )
12881288
1289+ # Test series.map method.
1290+ bf_result = bf_int64_filtered .map (is_positive_mf ).to_pandas ()
1291+ pd_result = pd_int64_filtered .map (_is_positive )
1292+
1293+ # Ignore any dtype difference.
1294+ pandas .testing .assert_series_equal (bf_result , pd_result , check_dtype = False )
1295+
12891296 finally :
12901297 # Clean up the gcp assets created for the managed function.
12911298 cleanup_function_assets (is_positive_mf , session .bqclient , ignore_failures = False )
You can’t perform that action at this time.
0 commit comments