File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -1042,6 +1042,21 @@ def wrapper(func):
1042
1042
cloud_function_docker_repository ,
1043
1043
)
1044
1044
1045
+ # In the unlikely case where the user is trying to re-deploy the same
1046
+ # function, cleanup the attributes we add below, first. This prevents
1047
+ # the pickle from having dependencies that might not otherwise be
1048
+ # present such as ibis or pandas.
1049
+ def try_delattr (attr ):
1050
+ try :
1051
+ delattr (func , attr )
1052
+ except AttributeError :
1053
+ pass
1054
+
1055
+ try_delattr ("bigframes_cloud_function" )
1056
+ try_delattr ("bigframes_remote_function" )
1057
+ try_delattr ("output_dtype" )
1058
+ try_delattr ("ibis_node" )
1059
+
1045
1060
rf_name , cf_name = remote_function_client .provision_bq_remote_function (
1046
1061
func ,
1047
1062
ibis_signature .input_types ,
Original file line number Diff line number Diff line change @@ -194,6 +194,9 @@ def test_remote_function_stringify_with_ibis(
194
194
def stringify (x ):
195
195
return f"I got { x } "
196
196
197
+ # Function should work locally.
198
+ assert stringify (42 ) == "I got 42"
199
+
197
200
_ , dataset_name , table_name = scalars_table_id .split ("." )
198
201
if not ibis_client .dataset :
199
202
ibis_client .dataset = dataset_name
@@ -205,7 +208,7 @@ def stringify(x):
205
208
pandas_df_orig = bigquery_client .query (sql ).to_dataframe ()
206
209
207
210
col = table [col_name ]
208
- col_2x = stringify (col ).name ("int64_str_col" )
211
+ col_2x = stringify . ibis_node (col ).name ("int64_str_col" )
209
212
table = table .mutate ([col_2x ])
210
213
sql = table .compile ()
211
214
pandas_df_new = bigquery_client .query (sql ).to_dataframe ()
You can’t perform that action at this time.
0 commit comments