4 Commits

Author SHA1 Message Date
congqixia
6c8e11da4f
feat: [GoSDK] add QueryIterator support for Go client (#46633)
Related to #31293

Implement QueryIterator for the Go SDK to enable efficient iteration
over large query result sets using PK-based pagination.

Key changes:
- Add QueryIterator interface and implementation with PK-based
pagination
- Support Int64 and VarChar primary key types for pagination filtering
- Add QueryIteratorOption with batchSize, limit, filter, outputFields
config
- Fix ResultSet.Slice to handle Query results without IDs/Scores
- Add comprehensive unit tests and integration tests

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
- Core invariant: the iterator requires the collection primary key (PK)
to be present in outputFields so PK-based pagination and accurate row
counting work. The constructor enforces this by appending the PK to
outputFields when absent, and all pagination (lastPK tracking, PK-range
filters) and ResultCount calculations depend on that guaranteed PK
column.

- New capability: adds a public QueryIterator API (Client.QueryIterator,
QueryIterator interface, QueryIteratorOption) that issues server-side
Query RPCs in configurable batches and implements PK-based pagination
supporting Int64 and VarChar PKs, with options for batchSize, limit,
filter, outputFields and an upfront first-batch validation to fail fast
on invalid params.

- Removed/simplified logic: ResultSet.Slice no longer assumes IDs and
Scores are always present — it branches on presence of IDs (use IDs
length when non-nil; otherwise derive row count from Fields[0]) and
guards Scores slicing. This eliminates redundant/unsafe assumptions and
centralizes correct row-count logic based on actual returned fields.

- No data loss or behavior regression: pagination composes the user
filter with a PK-range filter and always requests the PK field, so
lastPK is extracted from a real column and fetchNextBatch only advances
when rows are returned; EOF is returned only when the server returns no
rows or iterator limit is reached. ResultSet.Slice guards prevent panics
for queries that lack IDs/Scores; Query RPC → ResultSet.Fields remains
the authoritative path for row data, so rows are not dropped and
existing query behavior is preserved.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
2025-12-27 01:43:20 +08:00
congqixia
b8fe8aed53
enhance: [GoSDK] Add param static check for search iterator (#43774)
Related to #37548

This patch add static search option check logic:
- batch size shall be positive
- all negative limit shall be treated as `Unlimited`

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
2025-08-07 13:07:40 +08:00
congqixia
4def0255a9
enhance: [GoSDK] Support limit for search iterator (#43732)
Related to #37548

Add `WithIteratorLimit` option to limit search iterator overall return
limit.

---------

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
2025-08-05 16:43:38 +08:00
congqixia
18d8dc82b8
feat: [GoSDK] Support search iterator v2 (#43612)
Related to #37548

Also link #43122

This patch implements basic functions of search iterator v2.

---------

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
2025-07-29 11:21:35 +08:00