@@ -4108,32 +4108,26 @@ def map(self, func, na_action: Optional[str] = None) -> DataFrame:
41084108 )
41094109
41104110 def apply (self , func , * , axis = 0 , args : typing .Tuple = (), ** kwargs ):
4111- # In Bigframes remote function, DataFrame '.apply' method is specifically
4111+ # In Bigframes BigQuery function, DataFrame '.apply' method is specifically
41124112 # designed to work with row-wise or column-wise operations, where the input
41134113 # to the applied function should be a Series, not a scalar.
41144114
41154115 if utils .get_axis_number (axis ) == 1 :
41164116 msg = bfe .format_message ("axis=1 scenario is in preview." )
41174117 warnings .warn (msg , category = bfe .PreviewWarning )
41184118
4119- # TODO(jialuo): Deprecate the "bigframes_remote_function" attribute.
4120- # We have some tests using pre-defined remote_function that were
4121- # defined based on "bigframes_remote_function" instead of
4122- # "bigframes_bigquery_function". So we need to fix those pre-defined
4123- # remote functions before deprecating the "bigframes_remote_function"
4124- # attribute. Check if the function is a remote function.
4125- if not hasattr (func , "bigframes_remote_function" ) and not hasattr (
4126- func , "bigframes_bigquery_function"
4127- ):
4128- raise ValueError ("For axis=1 a bigframes function must be used." )
4119+ if not hasattr (func , "bigframes_bigquery_function" ):
4120+ raise ValueError (
4121+ "For axis=1 a BigFrames BigQuery function must be used."
4122+ )
41294123
41304124 is_row_processor = getattr (func , "is_row_processor" )
41314125 if is_row_processor :
41324126 # Early check whether the dataframe dtypes are currently supported
4133- # in the remote function
4127+ # in the bigquery function
41344128 # NOTE: Keep in sync with the value converters used in the gcf code
41354129 # generated in function_template.py
4136- remote_function_supported_dtypes = (
4130+ bigquery_function_supported_dtypes = (
41374131 bigframes .dtypes .INT_DTYPE ,
41384132 bigframes .dtypes .FLOAT_DTYPE ,
41394133 bigframes .dtypes .BOOL_DTYPE ,
@@ -4142,18 +4136,18 @@ def apply(self, func, *, axis=0, args: typing.Tuple = (), **kwargs):
41424136 )
41434137 supported_dtypes_types = tuple (
41444138 type (dtype )
4145- for dtype in remote_function_supported_dtypes
4139+ for dtype in bigquery_function_supported_dtypes
41464140 if not isinstance (dtype , pandas .ArrowDtype )
41474141 )
41484142 # Check ArrowDtype separately since multiple BigQuery types map to
41494143 # ArrowDtype, including BYTES and TIMESTAMP.
41504144 supported_arrow_types = tuple (
41514145 dtype .pyarrow_dtype
4152- for dtype in remote_function_supported_dtypes
4146+ for dtype in bigquery_function_supported_dtypes
41534147 if isinstance (dtype , pandas .ArrowDtype )
41544148 )
41554149 supported_dtypes_hints = tuple (
4156- str (dtype ) for dtype in remote_function_supported_dtypes
4150+ str (dtype ) for dtype in bigquery_function_supported_dtypes
41574151 )
41584152
41594153 for dtype in self .dtypes :
@@ -4186,10 +4180,11 @@ def apply(self, func, *, axis=0, args: typing.Tuple = (), **kwargs):
41864180 )
41874181 else :
41884182 # This is a special case where we are providing not-pandas-like
4189- # extension. If the remote function can take one or more params
4190- # then we assume that here the user intention is to use the
4191- # column values of the dataframe as arguments to the function.
4192- # For this to work the following condition must be true:
4183+ # extension. If the bigquery function can take one or more
4184+ # params then we assume that here the user intention is to use
4185+ # the column values of the dataframe as arguments to the
4186+ # function. For this to work the following condition must be
4187+ # true:
41934188 # 1. The number or input params in the function must be same
41944189 # as the number of columns in the dataframe
41954190 # 2. The dtypes of the columns in the dataframe must be
@@ -4231,15 +4226,16 @@ def apply(self, func, *, axis=0, args: typing.Tuple = (), **kwargs):
42314226
42324227 return result_series
42334228
4234- # At this point column-wise or element-wise remote function operation will
4229+ # At this point column-wise or element-wise bigquery function operation will
42354230 # be performed (not supported).
4236- if hasattr (func , "bigframes_remote_function " ):
4231+ if hasattr (func , "bigframes_bigquery_function " ):
42374232 raise formatter .create_exception_with_feedback_link (
42384233 NotImplementedError ,
4239- "BigFrames DataFrame '.apply()' does not support remote function "
4240- "for column-wise (i.e. with axis=0) operations, please use a "
4241- "regular python function instead. For element-wise operations of "
4242- "the remote function, please use '.map()'." ,
4234+ "BigFrames DataFrame '.apply()' does not support BigFrames "
4235+ "BigQuery function for column-wise (i.e. with axis=0) "
4236+ "operations, please use a regular python function instead. For "
4237+ "element-wise operations of the BigFrames BigQuery function, "
4238+ "please use '.map()'." ,
42434239 )
42444240
42454241 # Per-column apply
0 commit comments