Hello John, as with most things concering the *Value classes: Missing implementations are simply "not-done-yet" and not explicit omissions. The value instances have not yet seen that much use and therefore lack a lot of functionality. Feel free to add this to them.
Uwe On Sat, May 25, 2019, at 6:01 AM, John Muehlhausen wrote: > We have __eq__ leaning on as_py() already ... any reason not to have __lt__ > ? > > This makes it possible to use bisect to find slices in ordered data without > a __getitem__ wrapper: > > 1176.0 key=pa.array(['AAPL']) > 110.0 print(bisect.bisect_left(batch[3],key[0])) > 64.0 print(bisect.bisect_right(batch[3],key[0])) > > Although, I'm not sure why pa.array() is relatively slow (above in mics) > and whether I can directly construct an individual Value instead? batch[3] > is string type with length 32291182 (memory mapped from IPC File)... AAPL > being slice 206424 to 420255 in this case. > > Proposed addition: > > def __eq__(self, other): > if hasattr(self, 'as_py'): > if isinstance(other, ArrayValue): > other = other.as_py() > return self.as_py() == other > else: > raise NotImplementedError( > "Cannot compare Arrow values that don't support as_py()") > > * def __lt__(self, other):* > * if hasattr(self, 'as_py'):* > * if isinstance(other, ArrayValue):* > * other = other.as_py()* > * return self.as_py() < other* > * else:* > * raise NotImplementedError(* > * "Cannot compare Arrow values that don't support as_py()")* >