@@ -726,21 +726,14 @@ def _cmp_method(self, other, op) -> ArrowExtensionArray:
726
726
other , (ArrowExtensionArray , np .ndarray , list , BaseMaskedArray )
727
727
) or isinstance (getattr (other , "dtype" , None ), CategoricalDtype ):
728
728
try :
729
- other_array = self ._box_pa (other )
730
- if isinstance (other_array .type , pa .DictionaryType ):
731
- other_array = other_array .dictionary_decode ()
732
- if pa .types .is_string (other_array .type ):
733
- other_array = other_array .cast (pa .string ())
734
729
if pa .types .is_string (self ._pa_array .type ):
735
- self_array = self ._pa_array
736
- if not pa .types .is_string (other_array .type ):
737
- other_array = other_array .cast (pa .string ())
730
+ other_array = self ._box_pa (other )
731
+ self_array = self ._pa_array .cast (pa .large_string ())
732
+ if pa .types .is_string (other_array .type ):
733
+ other_array = other_array .cast (pa .large_string ())
738
734
result = pc_func (self_array , other_array )
739
735
else :
740
- result = pc_func (self ._pa_array , other_array )
741
- if result .type == pa .string ():
742
- result = result .cast (self ._pa_array .type )
743
- return type (self )(result )
736
+ result = pc_func (self ._pa_array , self ._box_pa (other ))
744
737
except pa .ArrowNotImplementedError :
745
738
# TODO: could this be wrong if other is object dtype?
746
739
# in which case we need to operate pointwise?
0 commit comments