@@ -890,16 +890,21 @@ def _op_method_error_message(self, other, op) -> str:
890
890
def _evaluate_op_method (self , other , op , arrow_funcs ) -> Self :
891
891
pa_type = self ._pa_array .type
892
892
other_original = other
893
- other_NA = self ._box_pa (other )
894
- # pyarrow gets upset if you try to join a NullArray
895
- other = other_NA .cast (pa_type )
893
+ other = self ._box_pa (other )
896
894
897
895
if (
898
896
pa .types .is_string (pa_type )
899
897
or pa .types .is_large_string (pa_type )
900
898
or pa .types .is_binary (pa_type )
901
899
):
902
900
if op in [operator .add , roperator .radd ]:
901
+ # pyarrow gets upset if you try to join a NullArray
902
+ if (
903
+ pa .types .is_integer (other .type )
904
+ or pa .types .is_floating (other .type )
905
+ or pa .types .is_null (other .type )
906
+ ):
907
+ other = other .cast (pa_type )
903
908
sep = pa .scalar ("" , type = pa_type )
904
909
try :
905
910
if op is operator .add :
@@ -913,7 +918,7 @@ def _evaluate_op_method(self, other, op, arrow_funcs) -> Self:
913
918
return self ._from_pyarrow_array (result )
914
919
elif op in [operator .mul , roperator .rmul ]:
915
920
binary = self ._pa_array
916
- integral = other_NA
921
+ integral = other
917
922
if not pa .types .is_integer (integral .type ):
918
923
raise TypeError ("Can only string multiply by an integer." )
919
924
pa_integral = pc .if_else (pc .less (integral , 0 ), 0 , integral )
0 commit comments