@@ -161,7 +161,10 @@ def _convert_expr_input(
161
161
def create_unary_op (name : str , type_signature : op_typing .UnaryTypeSignature ) -> UnaryOp :
162
162
return dataclasses .make_dataclass (
163
163
name ,
164
- [("name" , typing .ClassVar [str ], name ), ("output_type" , typing .ClassVar [typing .Callable ], type_signature .as_method )], # type: ignore
164
+ [
165
+ ("name" , typing .ClassVar [str ], name ),
166
+ ("output_type" , typing .ClassVar [typing .Callable ], type_signature .as_method ),
167
+ ],
165
168
bases = (UnaryOp ,),
166
169
frozen = True ,
167
170
)()
@@ -172,7 +175,10 @@ def create_binary_op(
172
175
) -> BinaryOp :
173
176
return dataclasses .make_dataclass (
174
177
name ,
175
- [("name" , typing .ClassVar [str ], name ), ("output_type" , typing .ClassVar [typing .Callable ], type_signature .as_method )], # type: ignore
178
+ [
179
+ ("name" , typing .ClassVar [str ], name ),
180
+ ("output_type" , typing .ClassVar [typing .Callable ], type_signature .as_method ),
181
+ ],
176
182
bases = (BinaryOp ,),
177
183
frozen = True ,
178
184
)()
@@ -493,8 +499,9 @@ def output_type(self, *input_types):
493
499
if self .to_type == pa .string ():
494
500
return dtypes .STRING_DTYPE
495
501
if isinstance (self .to_type , str ):
496
- # TODO(b/340895446): fix type error
497
- return dtypes .BIGFRAMES_STRING_TO_BIGFRAMES [self .to_type ] # type: ignore
502
+ return dtypes .BIGFRAMES_STRING_TO_BIGFRAMES [
503
+ typing .cast (dtypes .DtypeString , self .to_type )
504
+ ]
498
505
return self .to_type
499
506
500
507
@@ -516,8 +523,10 @@ class RemoteFunctionOp(UnaryOp):
516
523
517
524
def output_type (self , * input_types ):
518
525
# This property should be set to a valid Dtype by the @remote_function decorator or read_gbq_function method
519
- # TODO(b/340895446): fix type error
520
- return self .func .output_dtype # type: ignore
526
+ if hasattr (self .func , "output_dtype" ):
527
+ return self .func .output_dtype
528
+ else :
529
+ raise AttributeError ("output_dtype not defined" )
521
530
522
531
523
532
@dataclasses .dataclass (frozen = True )
@@ -644,8 +653,10 @@ class BinaryRemoteFunctionOp(BinaryOp):
644
653
645
654
def output_type (self , * input_types ):
646
655
# This property should be set to a valid Dtype by the @remote_function decorator or read_gbq_function method
647
- # TODO(b/340895446): fix type error
648
- return self .func .output_dtype # type: ignore
656
+ if hasattr (self .func , "output_dtype" ):
657
+ return self .func .output_dtype
658
+ else :
659
+ raise AttributeError ("output_dtype not defined" )
649
660
650
661
651
662
add_op = AddOp ()
0 commit comments