Hi guys, I found a quite obvious bug when I use the Bound filter.
The minimum code to reproduce the bug is as below:
from pydruid.utils.filters import Bound
# I want to select the rows that satisfy "foo >= 0"
Bound(dimension='foo', lower=0).show()
this will cause the following exception:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-76-afbba87ff9ee> in <module>
1 from pydruid.utils.filters import Bound
----> 2 Bound(dimension='foo', lower=0).show()
~/Library/Python/3.7/lib/python/site-packages/pydruid/utils/filters.py in __init__(self, dimension, lower, upper, lowerStrict, upperStrict, alphaNumeric, ordering, extraction_function)
216 ):
217 if not lower and not upper:
--> 218 raise ValueError("Must include either lower or upper or both")
219 Filter.__init__(
220 self,
ValueError: Must include either lower or upper or both
But when I changed lower=0 into lower=1, everything just went well:
Hi guys, I found a quite obvious bug when I use the
Bound
filter.The minimum code to reproduce the bug is as below:
this will cause the following exception:
But when I changed
lower=0
intolower=1
, everything just went well:output:
Obviously, the root of the problem lies in line 217, which is to check whether argument
lower
andupper
are both omitted:However, this checking unexpectedly blocked the number
0
, besidesNone
.Changing this line into the line below should fix the bug: