15
15
import dataclasses
16
16
import typing
17
17
18
- from bigframes import dtypes
19
18
from bigframes .operations import base_ops
20
19
21
20
@@ -31,17 +30,10 @@ def expensive(self) -> bool:
31
30
32
31
def output_type (self , * input_types ):
33
32
# This property should be set to a valid Dtype by the @remote_function decorator or read_gbq_function method
34
- if hasattr (self .func , "output_dtype" ):
35
- if dtypes .is_array_like (self .func .output_dtype ):
36
- # TODO(b/284515241): remove this special handling to support
37
- # array output types once BQ remote functions support ARRAY.
38
- # Until then, use json serialized strings at the remote function
39
- # level, and parse that to the intended output type at the
40
- # bigframes level.
41
- return dtypes .STRING_DTYPE
42
- return self .func .output_dtype
33
+ if hasattr (self .func , "bigframes_bigquery_function_output_dtype" ):
34
+ return self .func .bigframes_bigquery_function_output_dtype
43
35
else :
44
- raise AttributeError ("output_dtype not defined" )
36
+ raise AttributeError ("bigframes_bigquery_function_output_dtype not defined" )
45
37
46
38
47
39
@dataclasses .dataclass (frozen = True )
@@ -55,17 +47,10 @@ def expensive(self) -> bool:
55
47
56
48
def output_type (self , * input_types ):
57
49
# This property should be set to a valid Dtype by the @remote_function decorator or read_gbq_function method
58
- if hasattr (self .func , "output_dtype" ):
59
- if dtypes .is_array_like (self .func .output_dtype ):
60
- # TODO(b/284515241): remove this special handling to support
61
- # array output types once BQ remote functions support ARRAY.
62
- # Until then, use json serialized strings at the remote function
63
- # level, and parse that to the intended output type at the
64
- # bigframes level.
65
- return dtypes .STRING_DTYPE
66
- return self .func .output_dtype
50
+ if hasattr (self .func , "bigframes_bigquery_function_output_dtype" ):
51
+ return self .func .bigframes_bigquery_function_output_dtype
67
52
else :
68
- raise AttributeError ("output_dtype not defined" )
53
+ raise AttributeError ("bigframes_bigquery_function_output_dtype not defined" )
69
54
70
55
71
56
@dataclasses .dataclass (frozen = True )
@@ -79,14 +64,7 @@ def expensive(self) -> bool:
79
64
80
65
def output_type (self , * input_types ):
81
66
# This property should be set to a valid Dtype by the @remote_function decorator or read_gbq_function method
82
- if hasattr (self .func , "output_dtype" ):
83
- if dtypes .is_array_like (self .func .output_dtype ):
84
- # TODO(b/284515241): remove this special handling to support
85
- # array output types once BQ remote functions support ARRAY.
86
- # Until then, use json serialized strings at the remote function
87
- # level, and parse that to the intended output type at the
88
- # bigframes level.
89
- return dtypes .STRING_DTYPE
90
- return self .func .output_dtype
67
+ if hasattr (self .func , "bigframes_bigquery_function_output_dtype" ):
68
+ return self .func .bigframes_bigquery_function_output_dtype
91
69
else :
92
- raise AttributeError ("output_dtype not defined" )
70
+ raise AttributeError ("bigframes_bigquery_function_output_dtype not defined" )
0 commit comments