rtpsw commented on PR #13783: URL: https://github.com/apache/arrow/pull/13783#issuecomment-1205039499
> Hmm... can you point out the causes for confusion? Perhaps there's a way to improve that. > > Same for incompleteness: is the set of `Type::type` predicates incomplete? if so, we should add the missing and desired predicates. Sure. Check out [this commit](https://github.com/apache/arrow/pull/13783/commits/784d4fcd19ebf5be1cd4c2f0a6acc3a41b786e1f): - `is_numeric` is missing and I added it. - `is_primitive` exists but does not correspond to `PrimitiveTypes()`, which is confusing. I [added `is_primitive_like`](https://github.com/apache/arrow/pull/13783/commits/784d4fcd19ebf5be1cd4c2f0a6acc3a41b786e1f#diff-d606ef26a35a58e56fc01c680ea87eaaba5488b63b71fb7ab37930f81ec159b8R965) which does, though I'm not sold on the name. - I added the missing [`is_binary`](https://github.com/apache/arrow/pull/13783/commits/784d4fcd19ebf5be1cd4c2f0a6acc3a41b786e1f#diff-d606ef26a35a58e56fc01c680ea87eaaba5488b63b71fb7ab37930f81ec159b8R1028), [`is_string`](https://github.com/apache/arrow/pull/13783/commits/784d4fcd19ebf5be1cd4c2f0a6acc3a41b786e1f#diff-d606ef26a35a58e56fc01c680ea87eaaba5488b63b71fb7ab37930f81ec159b8R1039), [`is_temporal`](https://github.com/apache/arrow/pull/13783/commits/784d4fcd19ebf5be1cd4c2f0a6acc3a41b786e1f#diff-d606ef26a35a58e56fc01c680ea87eaaba5488b63b71fb7ab37930f81ec159b8R1050), and [`is_interval`](https://github.com/apache/arrow/pull/13783/commits/784d4fcd19ebf5be1cd4c2f0a6acc3a41b786e1f#diff-d606ef26a35a58e56fc01c680ea87eaaba5488b63b71fb7ab37930f81ec159b8R1064). - There are other `is_*()` primitives that do not correspond to any `*Types()` function - `is_base_binary_like` is one example. So, part of the confusion is the unexpected non-correspondence of `is_primitive` and part is due to missing and extra predicates with respect to the set of `*Types()` functions. In this PR, I extended the set of `is_*()` predicates to cover the correspondences and added `Is*Type()` predicates that correspond to `*Types()` functions as expected, while maintaining backwards-compatibility, and I added docs to clarify the meaning and correspondences. > Why is `is_primitive` not the one? It seems like it is returning the desired information, is it not? (is it missing some types perhaps?) As compared to `PrimitiveTypes()` (and `is_primitive_like()` that I added), `is_primitive` is missing `NA`, `BINARY`, `STRING`, `LARGE_BINARY` and `LARGE_STRING` while it adds `DURATION`, `INTERVAL_MONTHS`, `INTERVAL_MONTH_DAY_NANO`, `INTERVAL_DAY_TIME`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
