qdrant / qdrant/qdrant-client

DatetimeExpression causes trailing input error

Open
#985 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.4k
Forks
304
Avg merge
2d 9h
Merged PRs (30d)
37

Description

When using the new reranking functionality in query_points with a formula that includes a DatetimeExpression the following error is raised:

raise _create_rpc_error(
grpc.aio._call.AioRpcError: <AioRpcError of RPC that terminated with:
        status = StatusCode.INVALID_ARGUMENT
        details = "Wrong input: InvalidArgument: status: InvalidArgument, message: "failed to parse formula: Service internal error: trailing input", details: [], metadata: MetadataMap { headers: {"content-type": "application/grpc", "date": "Mon, 05 May 2025 05:31:47 GMT", "content-length": "0"} }"
        debug_error_string = "UNKNOWN:Error received from peer  {grpc_message:"Wrong input: InvalidArgument: status: InvalidArgument, message: \"failed to parse formula: Service internal error: trailing input\", details: [], metadata: MetadataMap { headers: {\"content-type\": \"application/grpc\", \"date\": \"Mon, 05 May 2025 05:31:47 GMT\", \"content-length\": \"0\"} }", grpc_status:3, created_time:"2025-05-05T07:31:48.460456036+02:00"}"

Formula used:

reranking_query = models.FormulaQuery(
            formula=models.SumExpression(
                sum=[
                    "$score",
                    models.DatetimeExpression(datetime='2025-05-05T07:18:25.401383')
                ]
            )
        )

Code works when replaced by:

reranking_query = models.FormulaQuery(
            formula=models.SumExpression(
                sum=[
                    "$score",
                    datetime.now().timestamp()
                ]
            )
        )

Code did not fail when tested with QdrantClient(":memory:"), only fails with the server mode.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Python client’s query_points reranking path, focusing on FormulaQuery, SumExpression, and DatetimeExpression serialization. Reproduce the reported formula against server mode and compare it with the numeric timestamp and in-memory cases. Done means a server accepts the datetime formula without the trailing-input error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.