Bug
DynamoDB BETWEEN filtering incorrectly excludes items whose attribute
value is exactly 0, even when 0 is within the specified range.
Reproduction
An item with:
is incorrectly excluded from:
while an item with price = 5 is included.
Root cause
FuncBetween.expr() checks the tested attribute using bare Python
truthiness (and attr). Since Decimal("0") is falsy, an attribute
whose value is zero incorrectly fails the condition.
The start and end operands already use zero-safe checks for this
exact reason, but attr does not.
Expected behavior
An attribute value of 0 should be included when it falls within the
specified BETWEEN range.
Bug
DynamoDB
BETWEENfiltering incorrectly excludes items whose attributevalue is exactly
0, even when0is within the specified range.Reproduction
An item with:
is incorrectly excluded from:
while an item with
price = 5is included.Root cause
FuncBetween.expr()checks the tested attribute using bare Pythontruthiness (
and attr). SinceDecimal("0")is falsy, an attributewhose value is zero incorrectly fails the condition.
The
startandendoperands already use zero-safe checks for thisexact reason, but
attrdoes not.Expected behavior
An attribute value of
0should be included when it falls within thespecified BETWEEN range.