Range filters cannot represent int64 payload values beyond 2^53 exactly
Current Behavior
Range filters on integer payloads cannot represent large int64 boundary values exactly.
With payload {"x": -9223372036854775807}, both of the following filters return no points:
- exact closed range:
gte=VALUE, lte=VALUE - open interval:
gt=VALUE-1, lt=VALUE+1In my repro, the inserted payload is stored correctly, but the range endpoints are coerced to floating-point values such as-9.223372036854776e+18, which loses int64 precision.
Steps to Reproduce
from qdrant_client import QdrantClient from qdrant_client.models import ( Distance, FieldCondition, Filter, PointStruct, Range, VectorParams, )
COLLECTION = "bug_int64_open_interval" VALUE = -9223372036854775807
def run(): client = QdrantClient(host="127.0.0.1", port=6333, grpc_port=6334, prefer_grpc=True)
if client.collection_exists(COLLECTION):
client.delete_collection(COLLECTION)
client.create_collection(
collection_name=COLLECTION,
vectors_config=VectorParams(size=2, distance=Distance.DOT),
)
client.upsert(
collection_name=COLLECTION,
points=[PointStruct(id=1, vector=[0.1, 0.1], payload={"x": VALUE})],
)
exact = Filter(must=[FieldCondition(key="x", range=Range(gte=VALUE, lte=VALUE))])
open_interval = Filter(
must=[FieldCondition(key="x", range=Range(gt=VALUE - 1, lt=VALUE + 1))]
)
exact_ids = [p.id for p in client.scroll(COLLECTION, scroll_filter=exact, with_payload=False, limit=10)[0]]
open_ids = [p.id for p in client.scroll(COLLECTION, scroll_filter=open_interval, with_payload=False, limit=10)[0]]
print("--- Qdrant int64 open interval repro ---")
print(f"Inserted value: {VALUE}")
print("exact closed range")
print(" expected: [1]")
print(f" actual: {exact_ids}")
print("open interval (VALUE-1, VALUE+1)")
print(" expected: [1]")
print(f" actual: {open_ids}")if name == "main": run()
Expected Behavior
Both queries should return the inserted point. For integer payloads, an exact closed range at the stored value should match, and the open interval (VALUE - 1, VALUE + 1) should also match.
Possible Solution
Use integer-safe range endpoints for integer payload filtering instead of floating-point endpoints.
Context (Environment)
This affects filtering on large int64 payload values near the 64-bit boundary and makes exact or near-exact numeric range queries impossible for those values.
Detailed Description
The issue appears to be that range boundaries are represented as floating-point numbers, which cannot exactly represent all int64 values beyond 2^53. As a result, large integer payload values can be stored correctly, but cannot be queried correctly with range filters. This is not just an "open interval" issue: even gte=VALUE, lte=VALUE fails.
Possible Implementation
Introduce an integer-aware range representation for integer payloads, or preserve integer boundary values without coercing them to float/double.
Source: qdrant/qdrant