@@ -1261,33 +1261,33 @@ def test_remote_function_via_session_custom_sa(scalars_dfs):
12611261 cloud_function_service_account = gcf_service_account ,
12621262 cloud_function_ingress_settings = "all" ,
12631263 )
1264- def square_num (x ):
1264+ def double_num (x ):
12651265 if x is None :
12661266 return x
1267- return x * x
1267+ return x + x
12681268
12691269 # assert that the GCF is created with the intended SA
12701270 gcf = rf_session .cloudfunctionsclient .get_function (
1271- name = square_num .bigframes_cloud_function
1271+ name = double_num .bigframes_cloud_function
12721272 )
12731273 assert gcf .service_config .service_account_email == gcf_service_account
12741274
12751275 # assert that the function works as expected on data
12761276 scalars_df , scalars_pandas_df = scalars_dfs
12771277
12781278 bf_int64_col = scalars_df ["int64_col" ]
1279- bf_result_col = bf_int64_col .apply (square_num )
1279+ bf_result_col = bf_int64_col .apply (double_num )
12801280 bf_result = bf_int64_col .to_frame ().assign (result = bf_result_col ).to_pandas ()
12811281
12821282 pd_int64_col = scalars_pandas_df ["int64_col" ]
1283- pd_result_col = pd_int64_col .apply (lambda x : x if x is None else x * x )
1283+ pd_result_col = pd_int64_col .apply (lambda x : x if x is None else x + x )
12841284 pd_result = pd_int64_col .to_frame ().assign (result = pd_result_col )
12851285
12861286 assert_frame_equal (bf_result , pd_result , check_dtype = False )
12871287 finally :
12881288 # clean up the gcp assets created for the remote function
12891289 cleanup_function_assets (
1290- square_num , rf_session .bqclient , rf_session .cloudfunctionsclient
1290+ double_num , rf_session .bqclient , rf_session .cloudfunctionsclient
12911291 )
12921292
12931293
@@ -1335,22 +1335,22 @@ def test_remote_function_via_session_custom_build_sa(
13351335 cloud_build_service_account = set_build_service_account ,
13361336 cloud_function_ingress_settings = "all" ,
13371337 )
1338- def square_num (x ):
1338+ def double_num (x ):
13391339 if x is None :
13401340 return x
1341- return x * x
1341+ return x + x
13421342
13431343 # assert that the GCF is created with the intended SA
13441344 gcf = rf_session .cloudfunctionsclient .get_function (
1345- name = square_num .bigframes_cloud_function
1345+ name = double_num .bigframes_cloud_function
13461346 )
13471347 assert gcf .build_config .service_account == expected_build_service_account
13481348
13491349 # assert that the function works as expected on data
13501350 scalars_df , scalars_pandas_df = scalars_dfs
13511351
13521352 bf_int64_col = scalars_df ["int64_col" ]
1353- bf_result_col = bf_int64_col .apply (square_num )
1353+ bf_result_col = bf_int64_col .apply (double_num )
13541354 bf_result = bf_int64_col .to_frame ().assign (result = bf_result_col ).to_pandas ()
13551355
13561356 pd_int64_col = scalars_pandas_df ["int64_col" ]
@@ -1361,7 +1361,7 @@ def square_num(x):
13611361 finally :
13621362 # clean up the gcp assets created for the remote function
13631363 cleanup_function_assets (
1364- square_num , rf_session .bqclient , rf_session .cloudfunctionsclient
1364+ double_num , rf_session .bqclient , rf_session .cloudfunctionsclient
13651365 )
13661366
13671367
@@ -1465,28 +1465,28 @@ def test_remote_function_via_session_vpc(scalars_dfs):
14651465
14661466 try :
14671467
1468- def square_num (x ):
1468+ def double_num (x ):
14691469 if x is None :
14701470 return x
1471- return x * x
1471+ return x + x
14721472
14731473 # TODO(shobs): See if the test vpc can be configured to make this flow
14741474 # work with the default ingress setting (internal-only)
1475- square_num_remote = rf_session .remote_function (
1475+ double_num_remote = rf_session .remote_function (
14761476 input_types = [int ],
14771477 output_type = int ,
14781478 reuse = False ,
14791479 cloud_function_service_account = "default" ,
14801480 cloud_function_vpc_connector = gcf_vpc_connector ,
14811481 cloud_function_vpc_connector_egress_settings = "all" ,
14821482 cloud_function_ingress_settings = "all" ,
1483- )(square_num )
1483+ )(double_num )
14841484
14851485 gcf = rf_session .cloudfunctionsclient .get_function (
1486- name = square_num_remote .bigframes_cloud_function
1486+ name = double_num_remote .bigframes_cloud_function
14871487 )
14881488
1489- # assert that the GCF is created with the intended vpc connector and
1489+ # assert that the GCF test_remote_function_via_session_custom_sais created with the intended vpc connector and
14901490 # egress settings.
14911491 assert gcf .service_config .vpc_connector == gcf_vpc_connector
14921492 # The value is <VpcConnectorEgressSettings.ALL_TRAFFIC: 2> since we set
@@ -1497,18 +1497,18 @@ def square_num(x):
14971497 scalars_df , scalars_pandas_df = scalars_dfs
14981498
14991499 bf_int64_col = scalars_df ["int64_col" ]
1500- bf_result_col = bf_int64_col .apply (square_num_remote )
1500+ bf_result_col = bf_int64_col .apply (double_num_remote )
15011501 bf_result = bf_int64_col .to_frame ().assign (result = bf_result_col ).to_pandas ()
15021502
15031503 pd_int64_col = scalars_pandas_df ["int64_col" ]
1504- pd_result_col = pd_int64_col .apply (square_num )
1504+ pd_result_col = pd_int64_col .apply (double_num ). astype ( "Int64" )
15051505 pd_result = pd_int64_col .to_frame ().assign (result = pd_result_col )
15061506
15071507 assert_frame_equal (bf_result , pd_result , check_dtype = False )
15081508 finally :
15091509 # clean up the gcp assets created for the remote function
15101510 cleanup_function_assets (
1511- square_num_remote , rf_session .bqclient , rf_session .cloudfunctionsclient
1511+ double_num_remote , rf_session .bqclient , rf_session .cloudfunctionsclient
15121512 )
15131513
15141514
0 commit comments