@@ -890,16 +890,21 @@ def _op_method_error_message(self, other, op) -> str:
890890 def _evaluate_op_method (self , other , op , arrow_funcs ) -> Self :
891891 pa_type = self ._pa_array .type
892892 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 )
896894
897895 if (
898896 pa .types .is_string (pa_type )
899897 or pa .types .is_large_string (pa_type )
900898 or pa .types .is_binary (pa_type )
901899 ):
902900 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 )
903908 sep = pa .scalar ("" , type = pa_type )
904909 try :
905910 if op is operator .add :
@@ -913,7 +918,7 @@ def _evaluate_op_method(self, other, op, arrow_funcs) -> Self:
913918 return self ._from_pyarrow_array (result )
914919 elif op in [operator .mul , roperator .rmul ]:
915920 binary = self ._pa_array
916- integral = other_NA
921+ integral = other
917922 if not pa .types .is_integer (integral .type ):
918923 raise TypeError ("Can only string multiply by an integer." )
919924 pa_integral = pc .if_else (pc .less (integral , 0 ), 0 , integral )
0 commit comments