@@ -2843,7 +2843,7 @@ def _apply_callable(self, condition):
28432843 """Executes the possible callable condition as needed."""
28442844 if callable (condition ):
28452845 # When it's a bigframes function.
2846- if hasattr (condition , "bigframes_bigquery_function" ):
2846+ if isinstance (condition , bigframes . functions . Udf ):
28472847 return self .apply (condition , axis = 1 )
28482848
28492849 # When it's a plain Python function.
@@ -4662,13 +4662,7 @@ def _prepare_export(
46624662 return array_value , id_overrides
46634663
46644664 def map (self , func , na_action : Optional [str ] = None ) -> DataFrame :
4665- if not isinstance (
4666- func ,
4667- (
4668- bigframes .functions .BigqueryCallableRoutine ,
4669- bigframes .functions .UdfRoutine ,
4670- ),
4671- ):
4665+ if not isinstance (func , bigframes .functions .Udf ):
46724666 raise TypeError ("the first argument must be callable" )
46734667
46744668 if na_action not in {None , "ignore" }:
@@ -4692,13 +4686,7 @@ def apply(self, func, *, axis=0, args: typing.Tuple = (), **kwargs):
46924686 )
46934687 warnings .warn (msg , category = bfe .FunctionAxisOnePreviewWarning )
46944688
4695- if not isinstance (
4696- func ,
4697- (
4698- bigframes .functions .BigqueryCallableRoutine ,
4699- bigframes .functions .UdfRoutine ,
4700- ),
4701- ):
4689+ if not isinstance (func , bigframes .functions .Udf ):
47024690 raise ValueError (
47034691 "For axis=1 a BigFrames BigQuery function must be used."
47044692 )
@@ -4832,7 +4820,7 @@ def apply(self, func, *, axis=0, args: typing.Tuple = (), **kwargs):
48324820
48334821 # At this point column-wise or element-wise bigquery function operation will
48344822 # be performed (not supported).
4835- if hasattr (func , "bigframes_bigquery_function" ):
4823+ if isinstance (func , bigframes . functions . Udf ):
48364824 raise formatter .create_exception_with_feedback_link (
48374825 NotImplementedError ,
48384826 "BigFrames DataFrame '.apply()' does not support BigFrames "
0 commit comments