pitrou commented on a change in pull request #11076: URL: https://github.com/apache/arrow/pull/11076#discussion_r702808196
########## File path: cpp/src/arrow/python/inference.cc ########## @@ -354,12 +354,17 @@ class TypeInferrer { *keep_going = make_unions_; } else if (PyArray_CheckAnyScalarExact(obj)) { RETURN_NOT_OK(VisitDType(PyArray_DescrFromScalar(obj), keep_going)); - } else if (PyList_Check(obj)) { - RETURN_NOT_OK(VisitList(obj, keep_going)); + } else if (PySet_Check(obj) || (Py_TYPE(obj) == &PyDictValues_Type)) { Review comment: It's true the list of consecutive checks started small and kept growing :-) Using a mapping (keyed by `Py_TYPE(self)`, I suppose?) might be more efficient, but that remains to be verified. Also, you have to populate the mapping dynamically, to be sure you don't miss any cases. That is: use a mapping as a cache with an unbounded size, but fallback on this sequence of checks. -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org