@@ -702,16 +702,16 @@ def _evaluate_op_method(self, other, op, arrow_funcs):
702
702
elif op is roperator .radd :
703
703
result = pc .binary_join_element_wise (other , self ._pa_array , sep )
704
704
return type (self )(result )
705
- elif op in [ operator . mul , roperator . rmul ]:
706
- result = type ( self ). _evaluate_binary_repeat ( self . _pa_array , other )
707
- return type ( self )( result )
708
- elif (
709
- pa . types . is_integer ( pa_type )
710
- and ( pa . types . is_string ( other . type ) or pa . types . is_binary ( other . type ) )
711
- and op in [ operator . mul , roperator . rmul ]
712
- ):
713
- result = type ( self ). _evaluate_binary_repeat ( other , self . _pa_array )
714
- return type (self )( result )
705
+
706
+ if op in [ operator . mul , roperator . rmul ]:
707
+ if pa . types . is_integer ( other . type ) and (
708
+ pa . types . is_string ( pa_type ) or pa . types . is_binary ( pa_type )
709
+ ):
710
+ return type ( self ). _evaluate_binary_repeat ( self . _pa_array , other )
711
+ elif pa . types . is_integer ( pa_type ) and (
712
+ pa . types . is_string ( other . type ) or pa . types . is_binary ( other . type )
713
+ ):
714
+ return type (self ). _evaluate_binary_repeat ( other , self . _pa_array )
715
715
if (
716
716
isinstance (other , pa .Scalar )
717
717
and pc .is_null (other ).as_py ()
@@ -727,12 +727,12 @@ def _evaluate_op_method(self, other, op, arrow_funcs):
727
727
result = pc_func (self ._pa_array , other )
728
728
return type (self )(result )
729
729
730
- @staticmethod
731
- def _evaluate_binary_repeat (binary , integral ):
730
+ @classmethod
731
+ def _evaluate_binary_repeat (cls , binary , integral ):
732
732
if not pa .types .is_integer (integral .type ):
733
733
raise TypeError ("Can only string multiply by an integer." )
734
734
pa_integral = pc .if_else (pc .less (integral , 0 ), 0 , integral )
735
- return pc .binary_repeat (binary , pa_integral )
735
+ return cls ( pc .binary_repeat (binary , pa_integral ) )
736
736
737
737
def _logical_method (self , other , op ):
738
738
# For integer types `^`, `|`, `&` are bitwise operators and return
0 commit comments