Description
In several Index
methods we have libjoin fastpaths and a check self._can_use_libjoin
to see if we can use it for a given dtype. The check in Index.join (but not the ones in _union or _intersection) also excludes CategoricalDtype from using the fastpath (and test_join_with_categorical_index breaks if we remove that check).
I'm guessing that the libjoin fastpaths in _union
and _intersection
may also need to exclude CategoricalDtype for the same reason(s) that join does. The task here is to confirm or disprove, and ensure we have tests that cover the relevant cases.
If it turns out that CategoricalDtype (maybe just ordered/unordered or something) should be excluded, then that can be done directly in _can_use_libjoin
.
Otherwise, a comment explaining why the join case is different from the others.
Afterthought possibility: excluding CategoricalDtype in join may only be necessary for how
that is not inner/outer, in which case the check can be made more precise (with comment as to why)