PyHive
PyHive copied to clipboard
support numpy types by escaping type numbers.Real
numpy int64 and float64 inconsistently derive from base int and float depending on python version. Checking against numbers.Real ensures correct behavior.
on python 3.6
>>> import numpy as np
>>> import numbers
>>>
>>> isinstance(np.int64(1), int)
False
>>> isinstance(np.float64(1.), float)
True
>>> isinstance(np.int64(1), numbers.Real)
True
>>> isinstance(np.float64(1), numbers.Real)
True
on python 2.7
>>> import numpy as np
>>> import numbers
>>>
>>> isinstance(np.int64(1), int)
True
>>> isinstance(np.int32(1), int)
False
>>> isinstance(np.float64(1.), float)
True
>>> isinstance(np.float32(1.), float)
False
>>> isinstance(np.int64(1), numbers.Real)
True
>>> isinstance(np.int32(1), numbers.Real)
True
>>> isinstance(np.float64(1), numbers.Real)
True
>>> isinstance(np.float32(1), numbers.Real)
True
@jingw Please review. Thanks.
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
Devin Stevenson seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.