mirror of
https://github.com/lancedb/lancedb.git
synced 2026-12-03 07:45:17 +00:00
fix: honor Enterprise query batch size limits (#5350)
Enterprise queries could return Arrow batches larger than the size explicitly requested by the caller. The SDK now slices oversized batches in the final query stream and keeps server-selected batch sizes when the caller omits the limit or passes zero. The search guide shows how to stream a full table or filtered scan in one query using Python's `search().to_batches()`. It covers older deployments that return buffered Arrow IPC files or enforce a query row cap. A local Enterprise 1.16.0 probe streamed all 131,073 rows from a pinned snapshot in one query, with batches of at most 37 rows and the first batch available before the Arrow end-of-stream marker. The probe ran with Plan Executor enabled and disabled. Related to OSS-3133.
This commit is contained in:
+5
-21
@@ -102,13 +102,9 @@ fn query_execution_options(
|
||||
max_batch_length: Option<u32>,
|
||||
timeout: Option<Duration>,
|
||||
) -> QueryExecutionOptions {
|
||||
let mut options = QueryExecutionOptions::default();
|
||||
if let Some(max_batch_length) = max_batch_length {
|
||||
options.max_batch_length = max_batch_length;
|
||||
}
|
||||
if let Some(timeout) = timeout {
|
||||
options.timeout = Some(timeout);
|
||||
}
|
||||
let mut options =
|
||||
QueryExecutionOptions::default().with_optional_max_batch_length(max_batch_length);
|
||||
options.timeout = timeout;
|
||||
options
|
||||
}
|
||||
|
||||
@@ -1060,13 +1056,7 @@ impl FTSQuery {
|
||||
.full_text_search(self_.fts_query_for_execution());
|
||||
|
||||
future_into_py(self_.py(), async move {
|
||||
let mut opts = QueryExecutionOptions::default();
|
||||
if let Some(max_batch_length) = max_batch_length {
|
||||
opts.max_batch_length = max_batch_length;
|
||||
}
|
||||
if let Some(timeout) = timeout {
|
||||
opts.timeout = Some(timeout);
|
||||
}
|
||||
let opts = query_execution_options(max_batch_length, timeout);
|
||||
let inner_stream = inner.execute_with_options(opts).await.infer_error()?;
|
||||
Ok(RecordBatchStream::new(inner_stream))
|
||||
})
|
||||
@@ -1351,13 +1341,7 @@ impl VectorQuery {
|
||||
) -> PyResult<Bound<'_, PyAny>> {
|
||||
let inner = self_.inner.clone();
|
||||
future_into_py(self_.py(), async move {
|
||||
let mut opts = QueryExecutionOptions::default();
|
||||
if let Some(max_batch_length) = max_batch_length {
|
||||
opts.max_batch_length = max_batch_length;
|
||||
}
|
||||
if let Some(timeout) = timeout {
|
||||
opts.timeout = Some(timeout);
|
||||
}
|
||||
let opts = query_execution_options(max_batch_length, timeout);
|
||||
let inner_stream = inner.execute_with_options(opts).await.infer_error()?;
|
||||
Ok(RecordBatchStream::new(inner_stream))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user