You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "CodeTrainerMan (via GitHub)" <gi...@apache.org> on 2026/09/18 20:10:57 UTC
[I] [Bug][api] VectorStoreQuery accepts a null or negative limit [flink-agents]
CodeTrainerMan opened a new issue, #1145:
URL: https://github.com/apache/flink-agents/issues/1145
## Search before asking
- [x] I searched in the [issues](https://github.com/apache/flink-agents/issues) and found nothing similar.
## Description
`VectorStoreQuery` accepts a `limit` that the query path cannot serve.
`BaseVectorStore#query(VectorStoreQuery)` unboxes `query.getLimit()`, an `Integer`, into the `int limit` parameter of `queryEmbedding`. Two inputs therefore fail in ways that never mention the parameter:
- `limit == null`: the unboxing throws a bare `NullPointerException` at the call site, with nothing in the message pointing at `limit`. Passing null is a natural thing to do, because `BaseVectorStore#get`'s Javadoc documents `limit=null` as "unbounded".
- `limit < 0`: the value is forwarded to the backend as-is, for example Chroma's `n_results` or OpenSearch's `size`, so the caller sees an unrelated store error or an empty result instead of being told the limit is invalid.
The Python `VectorStoreQuery.limit` field sets no lower bound, so the two languages do not agree on what a valid limit is.
Expected: building a query with a null or negative limit is rejected with an error naming the parameter, in both Java and Python. Zero and positive limits keep working as today.
## How to reproduce
Java:
```java
VectorStore store = ...; // any BaseVectorStore, e.g. ChromaVectorStore
store.query(new VectorStoreQuery(embedding, null)); // NullPointerException, message does not mention limit
store.query(new VectorStoreQuery(embedding, -1)); // forwarded to the backend as n_results=-1
```
Python:
```python
from flink_agents.api.vector_stores.vector_store import VectorStoreQuery
VectorStoreQuery(embedding=embedding, limit=-1) # accepted
```
## Version and environment
main branch (commit `a149de91`). JDK 17 for Java, Python 3.10+ for Python, OS independent.
## Are you willing to submit a PR?
- [x] I'm willing to submit a PR!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug][api] VectorStoreQuery accepts a null or negative limit [flink-agents]
Posted by "wenjin272 (via GitHub)" <gi...@apache.org>.
wenjin272 closed issue #1145: [Bug][api] VectorStoreQuery accepts a null or negative limit
URL: https://github.com/apache/flink-agents/issues/1145
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org