mirror of
https://github.com/lancedb/lancedb.git
synced 2026-11-26 12:33:59 +00:00
Merge main into gatekeeper/fix-4911-1
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "lancedb-python"
|
||||
version = "0.42.0-beta.9"
|
||||
version = "0.42.0-beta.10"
|
||||
publish = false
|
||||
edition.workspace = true
|
||||
description = "Python bindings for LanceDB"
|
||||
|
||||
@@ -64,7 +64,7 @@ tests = [
|
||||
"polars>=0.19, <=1.32.3",
|
||||
"pyarrow>=16",
|
||||
"pyarrow-stubs>=16.0",
|
||||
"pylance==15.0.0b15",
|
||||
"pylance==15.0.0b16",
|
||||
"requests>=2.31.0",
|
||||
"datafusion>=54,<55",
|
||||
"opentelemetry-sdk>=1.30.0",
|
||||
|
||||
@@ -619,6 +619,7 @@ class Table:
|
||||
*,
|
||||
where: Optional[str] = None,
|
||||
batch_size: Optional[int] = None,
|
||||
publication_interval_rows: Optional[int] = None,
|
||||
gpu_class: Optional[str] = None,
|
||||
gpu_count: Optional[int] = None,
|
||||
retry_policy: Optional[str] = None,
|
||||
@@ -636,6 +637,7 @@ class Table:
|
||||
*,
|
||||
where: Optional[str] = None,
|
||||
batch_size: Optional[int] = None,
|
||||
publication_interval_rows: Optional[int] = None,
|
||||
gpu_class: Optional[str] = None,
|
||||
gpu_count: Optional[int] = None,
|
||||
retry_policy: Optional[str] = None,
|
||||
|
||||
@@ -1335,6 +1335,9 @@ class LanceQueryBuilder(ABC):
|
||||
and also the "_distance" column which is the distance between the query
|
||||
vector and the returned vectors.
|
||||
|
||||
This collects all results in memory. To process a large result a batch
|
||||
at a time, use [to_batches][lancedb.query.LanceQueryBuilder.to_batches].
|
||||
|
||||
Parameters
|
||||
----------
|
||||
timeout: Optional[timedelta]
|
||||
@@ -1366,6 +1369,11 @@ class LanceQueryBuilder(ABC):
|
||||
``fetch_blobs``. The ``"bytes"`` and ``"descriptions"`` modes hide
|
||||
automatic row ids.
|
||||
|
||||
A remote table decodes batches as they arrive when the server streams
|
||||
query results. If the response stops partway, reading raises
|
||||
[ResponseInterruptedError][lancedb.remote.errors.ResponseInterruptedError]
|
||||
after the batches already returned, which are valid but incomplete.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
batch_size: int
|
||||
@@ -1373,6 +1381,8 @@ class LanceQueryBuilder(ABC):
|
||||
timeout: Optional[timedelta]
|
||||
The maximum time to wait for the query to complete.
|
||||
If None, wait indefinitely.
|
||||
The timeout also covers reading the batches, so consuming them
|
||||
slowly can exceed it.
|
||||
blob_mode: str, default "lazy"
|
||||
``"lazy"`` keeps blob descriptors and auto row ids for manual fetches.
|
||||
``"descriptions"`` omits auto row ids. ``"bytes"`` fetches blob v2
|
||||
@@ -2303,6 +2313,8 @@ class LanceVectorQueryBuilder(LanceQueryBuilder):
|
||||
timeout: timedelta, default None
|
||||
The maximum time to wait for the query to complete.
|
||||
If None, wait indefinitely.
|
||||
The timeout also covers reading the batches, so consuming them
|
||||
slowly can exceed it.
|
||||
blob_mode: str, default "lazy"
|
||||
Controls blob conversion as described in
|
||||
:meth:`LanceQueryBuilder.to_batches`.
|
||||
@@ -3570,6 +3582,11 @@ class AsyncQueryBase(object):
|
||||
"""
|
||||
Execute the query and return the results as an Apache Arrow RecordBatchReader.
|
||||
|
||||
A remote table decodes batches as they arrive when the server streams
|
||||
query results. If the response stops partway, reading raises
|
||||
[ResponseInterruptedError][lancedb.remote.errors.ResponseInterruptedError]
|
||||
after the batches already returned, which are valid but incomplete.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
||||
@@ -3582,6 +3599,8 @@ class AsyncQueryBase(object):
|
||||
The maximum time to wait for the query to complete.
|
||||
If not specified, no timeout is applied. If the query does not
|
||||
complete within the specified time, an error will be raised.
|
||||
The timeout also covers reading the batches, so consuming them
|
||||
slowly can exceed it.
|
||||
blob_mode: str, default "lazy"
|
||||
``"lazy"`` keeps blob descriptors and auto row ids for manual fetches.
|
||||
``"descriptions"`` omits auto row ids. ``"bytes"`` fetches blob v2
|
||||
@@ -5114,6 +5133,8 @@ class BaseQueryBuilder(object):
|
||||
The maximum time to wait for the query to complete.
|
||||
If not specified, no timeout is applied. If the query does not
|
||||
complete within the specified time, an error will be raised.
|
||||
The timeout also covers reading the batches, so consuming them
|
||||
slowly can exceed it.
|
||||
blob_mode: str, default "lazy"
|
||||
Controls blob conversion as described in
|
||||
:meth:`AsyncQueryBase.to_batches`.
|
||||
|
||||
@@ -286,6 +286,64 @@ class ConflictError(HttpError):
|
||||
"""
|
||||
|
||||
|
||||
class ResponseInterruptedError(HttpError):
|
||||
"""A streamed query response stopped before the server finished sending it.
|
||||
|
||||
The batches already returned are valid, but the result is incomplete. The
|
||||
query is not retried automatically, because a new attempt would return those
|
||||
rows a second time. To read the same data in a new attempt, check out
|
||||
``table_version`` first.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
batches: int
|
||||
The number of batches returned before the interruption.
|
||||
rows: int
|
||||
The number of rows in those batches.
|
||||
table_version: int or None
|
||||
The table version the response reflected, if the server reported it.
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> error = ResponseInterruptedError("interrupted", "req-1", 2, 2048, 7)
|
||||
>>> isinstance(error, HttpError)
|
||||
True
|
||||
>>> (error.rows, error.table_version)
|
||||
(2048, 7)
|
||||
"""
|
||||
|
||||
# HttpError.__new__ takes HttpError's arguments, to choose a subclass.
|
||||
def __new__(cls, *args, **kwargs):
|
||||
return RuntimeError.__new__(cls)
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
message: str,
|
||||
request_id: str,
|
||||
batches: int,
|
||||
rows: int,
|
||||
table_version: Optional[int] = None,
|
||||
is_transport_error: bool = False,
|
||||
):
|
||||
super().__init__(message, request_id, is_transport_error=is_transport_error)
|
||||
self.batches = batches
|
||||
self.rows = rows
|
||||
self.table_version = table_version
|
||||
|
||||
def __reduce__(self) -> tuple[type, tuple]:
|
||||
return (
|
||||
self.__class__,
|
||||
(
|
||||
str(self),
|
||||
self.request_id,
|
||||
self.batches,
|
||||
self.rows,
|
||||
self.table_version,
|
||||
self.is_transport_error,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
class TableNotFoundError(HttpError, ValueError, _NamespaceTableNotFoundError):
|
||||
"""A remote table was not found.
|
||||
|
||||
|
||||
@@ -1143,6 +1143,7 @@ class RemoteTable(Table):
|
||||
*,
|
||||
where: Optional[str] = None,
|
||||
batch_size: Optional[int] = None,
|
||||
publication_interval_rows: Optional[int] = None,
|
||||
gpu_class: Optional[str] = None,
|
||||
gpu_count: Optional[int] = None,
|
||||
retry_policy: Optional[FunctionRetryPolicy] = None,
|
||||
@@ -1159,6 +1160,7 @@ class RemoteTable(Table):
|
||||
column,
|
||||
where=where,
|
||||
batch_size=batch_size,
|
||||
publication_interval_rows=publication_interval_rows,
|
||||
gpu_class=gpu_class,
|
||||
gpu_count=gpu_count,
|
||||
retry_policy=retry_policy,
|
||||
@@ -1178,6 +1180,7 @@ class RemoteTable(Table):
|
||||
*,
|
||||
where: Optional[str] = None,
|
||||
batch_size: Optional[int] = None,
|
||||
publication_interval_rows: Optional[int] = None,
|
||||
gpu_class: Optional[str] = None,
|
||||
gpu_count: Optional[int] = None,
|
||||
retry_policy: Optional[FunctionRetryPolicy] = None,
|
||||
@@ -1195,6 +1198,7 @@ class RemoteTable(Table):
|
||||
column,
|
||||
where=where,
|
||||
batch_size=batch_size,
|
||||
publication_interval_rows=publication_interval_rows,
|
||||
gpu_class=gpu_class,
|
||||
gpu_count=gpu_count,
|
||||
retry_policy=retry_policy,
|
||||
|
||||
@@ -3178,6 +3178,7 @@ class Table(ABC):
|
||||
*,
|
||||
where: Optional[str] = None,
|
||||
batch_size: Optional[int] = None,
|
||||
publication_interval_rows: Optional[int] = None,
|
||||
gpu_class: Optional[str] = None,
|
||||
gpu_count: Optional[int] = None,
|
||||
retry_policy: Optional[FunctionRetryPolicy] = None,
|
||||
@@ -3216,6 +3217,12 @@ class Table(ABC):
|
||||
Maximum rows per Function call on the remote server. Must be
|
||||
greater than zero. None uses the server default. Has no effect on
|
||||
local expression-backed columns.
|
||||
publication_interval_rows: int, optional
|
||||
Opt-in publication threshold for completed Function outputs. Must
|
||||
be greater than zero. None keeps whole-fragment publication. The
|
||||
actual publication boundary can be larger than this threshold
|
||||
because it also depends on completed work and Function batching.
|
||||
LanceDB Enterprise only; local refreshes reject this option.
|
||||
gpu_class: str, optional
|
||||
GPU class for Function workers. Must be a lowercase name of 1-63
|
||||
letters, digits, or hyphens, without a leading or trailing hyphen.
|
||||
@@ -3263,6 +3270,7 @@ class Table(ABC):
|
||||
*,
|
||||
where: Optional[str] = None,
|
||||
batch_size: Optional[int] = None,
|
||||
publication_interval_rows: Optional[int] = None,
|
||||
gpu_class: Optional[str] = None,
|
||||
gpu_count: Optional[int] = None,
|
||||
retry_policy: Optional[FunctionRetryPolicy] = None,
|
||||
@@ -3300,6 +3308,12 @@ class Table(ABC):
|
||||
greater than zero. None uses the server default. Lower this for
|
||||
slow Functions to stay within the executor's per-call deadline.
|
||||
Has no effect on local expression-backed columns.
|
||||
publication_interval_rows: int, optional
|
||||
Opt-in publication threshold for completed Function outputs. Must
|
||||
be greater than zero. None keeps whole-fragment publication. The
|
||||
actual publication boundary can be larger than this threshold
|
||||
because it also depends on completed work and Function batching.
|
||||
LanceDB Enterprise only; local refreshes reject this option.
|
||||
gpu_class: str, optional
|
||||
GPU class for Function workers. Must be a lowercase name of 1-63
|
||||
letters, digits, or hyphens, without a leading or trailing hyphen.
|
||||
@@ -5442,6 +5456,7 @@ class LanceTable(Table):
|
||||
*,
|
||||
where: Optional[str] = None,
|
||||
batch_size: Optional[int] = None,
|
||||
publication_interval_rows: Optional[int] = None,
|
||||
gpu_class: Optional[str] = None,
|
||||
gpu_count: Optional[int] = None,
|
||||
retry_policy: Optional[FunctionRetryPolicy] = None,
|
||||
@@ -5461,6 +5476,7 @@ class LanceTable(Table):
|
||||
column,
|
||||
where=where,
|
||||
batch_size=batch_size,
|
||||
publication_interval_rows=publication_interval_rows,
|
||||
gpu_class=gpu_class,
|
||||
gpu_count=gpu_count,
|
||||
retry_policy=retry_policy,
|
||||
@@ -5480,6 +5496,7 @@ class LanceTable(Table):
|
||||
*,
|
||||
where: Optional[str] = None,
|
||||
batch_size: Optional[int] = None,
|
||||
publication_interval_rows: Optional[int] = None,
|
||||
gpu_class: Optional[str] = None,
|
||||
gpu_count: Optional[int] = None,
|
||||
retry_policy: Optional[FunctionRetryPolicy] = None,
|
||||
@@ -5501,6 +5518,7 @@ class LanceTable(Table):
|
||||
column,
|
||||
where=where,
|
||||
batch_size=batch_size,
|
||||
publication_interval_rows=publication_interval_rows,
|
||||
gpu_class=gpu_class,
|
||||
gpu_count=gpu_count,
|
||||
retry_policy=retry_policy,
|
||||
@@ -7865,6 +7883,7 @@ class AsyncTable:
|
||||
*,
|
||||
where: Optional[str] = None,
|
||||
batch_size: Optional[int] = None,
|
||||
publication_interval_rows: Optional[int] = None,
|
||||
gpu_class: Optional[str] = None,
|
||||
gpu_count: Optional[int] = None,
|
||||
retry_policy: Optional[FunctionRetryPolicy] = None,
|
||||
@@ -7903,6 +7922,12 @@ class AsyncTable:
|
||||
Maximum rows per Function call on the remote server. Must be
|
||||
greater than zero. None uses the server default. Has no effect on
|
||||
local expression-backed columns.
|
||||
publication_interval_rows: int, optional
|
||||
Opt-in publication threshold for completed Function outputs. Must
|
||||
be greater than zero. None keeps whole-fragment publication. The
|
||||
actual publication boundary can be larger than this threshold
|
||||
because it also depends on completed work and Function batching.
|
||||
LanceDB Enterprise only; local refreshes reject this option.
|
||||
gpu_class: str, optional
|
||||
GPU class for Function workers. Must be a lowercase name of 1-63
|
||||
letters, digits, or hyphens, without a leading or trailing hyphen.
|
||||
@@ -7945,6 +7970,7 @@ class AsyncTable:
|
||||
column,
|
||||
where=where,
|
||||
batch_size=batch_size,
|
||||
publication_interval_rows=publication_interval_rows,
|
||||
gpu_class=gpu_class,
|
||||
gpu_count=gpu_count,
|
||||
retry_policy=None
|
||||
@@ -8054,6 +8080,7 @@ class AsyncTable:
|
||||
*,
|
||||
where: Optional[str] = None,
|
||||
batch_size: Optional[int] = None,
|
||||
publication_interval_rows: Optional[int] = None,
|
||||
gpu_class: Optional[str] = None,
|
||||
gpu_count: Optional[int] = None,
|
||||
retry_policy: Optional[FunctionRetryPolicy] = None,
|
||||
@@ -8091,6 +8118,12 @@ class AsyncTable:
|
||||
greater than zero. None uses the server default. Lower this for
|
||||
slow Functions to stay within the executor's per-call deadline.
|
||||
Has no effect on local expression-backed columns.
|
||||
publication_interval_rows: int, optional
|
||||
Opt-in publication threshold for completed Function outputs. Must
|
||||
be greater than zero. None keeps whole-fragment publication. The
|
||||
actual publication boundary can be larger than this threshold
|
||||
because it also depends on completed work and Function batching.
|
||||
LanceDB Enterprise only; local refreshes reject this option.
|
||||
gpu_class: str, optional
|
||||
GPU class for Function workers. Must be a lowercase name of 1-63
|
||||
letters, digits, or hyphens, without a leading or trailing hyphen.
|
||||
@@ -8150,6 +8183,7 @@ class AsyncTable:
|
||||
column,
|
||||
where=where,
|
||||
batch_size=batch_size,
|
||||
publication_interval_rows=publication_interval_rows,
|
||||
gpu_class=gpu_class,
|
||||
gpu_count=gpu_count,
|
||||
retry_policy=None
|
||||
|
||||
@@ -15,6 +15,7 @@ from lancedb.remote.errors import (
|
||||
HttpError,
|
||||
LanceDBClientError,
|
||||
NamespaceNotFoundError,
|
||||
ResponseInterruptedError,
|
||||
RetryError,
|
||||
SecretNotFoundError,
|
||||
TableNotFoundError,
|
||||
@@ -73,6 +74,17 @@ def test_pickle_http_transport_error():
|
||||
assert restored.request_id == "req-789"
|
||||
|
||||
|
||||
def test_pickle_response_interrupted_error():
|
||||
err = ResponseInterruptedError("interrupted", "req-1", 2, 2048, 7, True)
|
||||
restored = pickle.loads(pickle.dumps(err))
|
||||
assert type(restored) is ResponseInterruptedError
|
||||
assert str(restored) == "interrupted"
|
||||
assert restored.request_id == "req-1"
|
||||
assert (restored.batches, restored.rows, restored.table_version) == (2, 2048, 7)
|
||||
assert restored.is_transport_error is True
|
||||
assert restored.status_code is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize("error_code", [None, "conflict", "future_conflict_code"])
|
||||
def test_http_conflict_error_preserves_reason_and_metadata(error_code):
|
||||
reason = "Conflict: branch 'exp' cannot be deleted, main depends on its files"
|
||||
|
||||
@@ -48,6 +48,7 @@ from lancedb.remote.errors import (
|
||||
ConflictError,
|
||||
HttpError,
|
||||
NamespaceNotFoundError,
|
||||
ResponseInterruptedError,
|
||||
RetryError,
|
||||
)
|
||||
import pytest
|
||||
@@ -1862,6 +1863,7 @@ def test_remote_create_index_async_returns_job():
|
||||
{"batch_size": None},
|
||||
{"batch_size": 1},
|
||||
{"batch_size": 8},
|
||||
{"publication_interval_rows": 60},
|
||||
{"gpu_class": "a10g", "gpu_count": 2},
|
||||
{
|
||||
"retry_policy": {"transient": True, "max_attempts": 3},
|
||||
@@ -1910,6 +1912,7 @@ async def test_remote_refresh_async_returns_typed_terminal_result(
|
||||
expected["error_policy"] = refresh_kwargs["error_policy"]
|
||||
for key in (
|
||||
"where",
|
||||
"publication_interval_rows",
|
||||
"max_failed_fraction",
|
||||
"max_failed_rows",
|
||||
"row_timeout_seconds",
|
||||
@@ -2087,6 +2090,8 @@ def test_remote_refresh_async_forwards_progress_from_submitted_handle():
|
||||
({"max_failed_rows": -1}, "max_failed_rows"),
|
||||
({"row_timeout_seconds": 0}, "row_timeout_seconds"),
|
||||
({"init_timeout_seconds": -5}, "init_timeout_seconds"),
|
||||
({"publication_interval_rows": 0}, "publication_interval_rows"),
|
||||
({"publication_interval_rows": -1}, "publication_interval_rows"),
|
||||
({"num_workers": 0}, "num_workers"),
|
||||
(
|
||||
{"max_executor_processes_per_worker": -2},
|
||||
@@ -3398,6 +3403,100 @@ def test_query_sync_minimal():
|
||||
assert data == expected
|
||||
|
||||
|
||||
def _arrow_stream(batches):
|
||||
sink = pa.BufferOutputStream()
|
||||
with pa.ipc.new_stream(sink, batches[0].schema) as writer:
|
||||
for batch in batches:
|
||||
writer.write_batch(batch)
|
||||
return sink.getvalue().to_pybytes()
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def streamed_query_table(write_body):
|
||||
"""Yield a remote table and the headers of each query request it sends.
|
||||
|
||||
Queries get a 200 response with stream framing, whose body ``write_body``
|
||||
writes after the other headers.
|
||||
"""
|
||||
queries = []
|
||||
|
||||
def handler(request):
|
||||
if request.path == "/v1/table/test/describe/":
|
||||
id_field = {"name": "id", "type": {"type": "int32"}, "nullable": True}
|
||||
schema = {"fields": [id_field]}
|
||||
request.send_response(200)
|
||||
request.send_header("Content-Type", "application/json")
|
||||
request.end_headers()
|
||||
request.wfile.write(json.dumps({"version": 7, "schema": schema}).encode())
|
||||
elif request.path == "/v1/table/test/query/":
|
||||
queries.append(request.headers)
|
||||
request.rfile.read(int(request.headers["Content-Length"]))
|
||||
request.send_response(200)
|
||||
request.send_header("Content-Type", "application/vnd.apache.arrow.stream")
|
||||
request.send_header("x-lancedb-version", "7")
|
||||
write_body(request)
|
||||
else:
|
||||
request.send_response(404)
|
||||
request.end_headers()
|
||||
|
||||
with mock_lancedb_connection(handler) as db:
|
||||
yield db.open_table("test"), queries
|
||||
|
||||
|
||||
def test_query_sync_to_batches_yields_before_the_body_is_complete():
|
||||
batches = [pa.record_batch({"id": pa.array([i], pa.int32())}) for i in range(3)]
|
||||
body = _arrow_stream(batches)
|
||||
# The schema and first batch, without the 8-byte end-of-stream marker.
|
||||
head = _arrow_stream(batches[:1])[:-8]
|
||||
first_batch_read = threading.Event()
|
||||
waited_for_client = []
|
||||
|
||||
def write_body(request):
|
||||
request.end_headers()
|
||||
request.wfile.write(head)
|
||||
waited_for_client.append(first_batch_read.wait(10))
|
||||
request.wfile.write(body[len(head) :])
|
||||
|
||||
with streamed_query_table(write_body) as (table, queries):
|
||||
reader = table.search().to_batches()
|
||||
assert reader.read_next_batch()["id"].to_pylist() == [0]
|
||||
first_batch_read.set()
|
||||
assert reader.read_all()["id"].to_pylist() == [1, 2]
|
||||
|
||||
# The wait times out if the client needs the whole body for the first batch.
|
||||
assert waited_for_client == [True]
|
||||
assert queries[0]["Accept"] == (
|
||||
"application/vnd.apache.arrow.stream, application/vnd.apache.arrow.file;q=0.9"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("abort", [False, True], ids=["clean_end", "abort"])
|
||||
def test_query_sync_interrupted_response_raises(abort):
|
||||
batches = [pa.record_batch({"id": pa.array([i], pa.int32())}) for i in range(3)]
|
||||
head = _arrow_stream(batches[:1])[:-8]
|
||||
|
||||
def write_body(request):
|
||||
if abort:
|
||||
# Closing before the promised length is a transport error. Otherwise
|
||||
# the body ends cleanly, but without the end-of-stream marker.
|
||||
request.send_header("Content-Length", str(len(head) + 100))
|
||||
request.end_headers()
|
||||
request.wfile.write(head)
|
||||
|
||||
with streamed_query_table(write_body) as (table, queries):
|
||||
reader = table.search().to_batches()
|
||||
assert reader.read_next_batch()["id"].to_pylist() == [0]
|
||||
with pytest.raises(ResponseInterruptedError) as exc_info:
|
||||
reader.read_next_batch()
|
||||
|
||||
error = exc_info.value
|
||||
assert isinstance(error, HttpError)
|
||||
assert (error.batches, error.rows, error.table_version) == (1, 1, 7)
|
||||
assert error.request_id == queries[0]["x-request-id"]
|
||||
assert error.is_transport_error is abort
|
||||
assert len(queries) == 1
|
||||
|
||||
|
||||
@pytest.mark.parametrize("query_type", ["auto", "vector", "hybrid"])
|
||||
@pytest.mark.parametrize("vector_column_name", [None, "embedding"])
|
||||
def test_query_sync_text_embedding(query_type, vector_column_name):
|
||||
|
||||
@@ -5995,6 +5995,7 @@ def test_refresh_column_rejects_invalid_batch_size(tmp_path, method, batch_size)
|
||||
({"max_failed_rows": 10}, "max_failed_rows"),
|
||||
({"row_timeout_seconds": 30}, "row_timeout_seconds"),
|
||||
({"init_timeout_seconds": 60}, "init_timeout_seconds"),
|
||||
({"publication_interval_rows": 60}, "publication_interval_rows"),
|
||||
({"num_workers": 2}, "num_workers"),
|
||||
({"max_executor_processes_per_worker": 2}, "max_executor_processes_per_worker"),
|
||||
],
|
||||
|
||||
@@ -168,6 +168,28 @@ impl<T> PythonErrorExt<T> for std::result::Result<T, LanceError> {
|
||||
err.setattr(intern!(py, "__cause__"), cause_err)?;
|
||||
Err(PyErr::from_value(err))
|
||||
}),
|
||||
LanceError::ResponseInterrupted {
|
||||
request_id,
|
||||
batches,
|
||||
rows,
|
||||
table_version,
|
||||
source,
|
||||
} => Python::attach(|py| {
|
||||
let error = py
|
||||
.import(intern!(py, "lancedb.remote.errors"))?
|
||||
.getattr(intern!(py, "ResponseInterruptedError"))?
|
||||
.call1((
|
||||
err.to_string(),
|
||||
request_id,
|
||||
*batches,
|
||||
*rows,
|
||||
*table_version,
|
||||
is_transport_error(&**source),
|
||||
))?;
|
||||
let cause = http_from_rust_error(py, &**source, request_id, None)?;
|
||||
error.setattr(intern!(py, "__cause__"), cause)?;
|
||||
Err(PyErr::from_value(error))
|
||||
}),
|
||||
LanceError::Sql {
|
||||
message,
|
||||
request_id,
|
||||
|
||||
+10
-2
@@ -46,6 +46,7 @@ mod scannable;
|
||||
struct RefreshColumnArgs {
|
||||
where_clause: Option<String>,
|
||||
batch_size: Option<i64>,
|
||||
publication_interval_rows: Option<i64>,
|
||||
gpu_class: Option<String>,
|
||||
gpu_count: Option<i64>,
|
||||
retry_policy: Option<String>,
|
||||
@@ -73,6 +74,7 @@ fn refresh_column_options(args: RefreshColumnArgs) -> PyResult<RefreshColumnOpti
|
||||
let RefreshColumnArgs {
|
||||
where_clause,
|
||||
batch_size,
|
||||
publication_interval_rows,
|
||||
gpu_class,
|
||||
gpu_count,
|
||||
retry_policy,
|
||||
@@ -114,6 +116,8 @@ fn refresh_column_options(args: RefreshColumnArgs) -> PyResult<RefreshColumnOpti
|
||||
.map(usize::try_from)
|
||||
.transpose()
|
||||
.map_err(|_| PyValueError::new_err("batch_size must be greater than zero"))?;
|
||||
options.publication_interval_rows =
|
||||
positive_count(publication_interval_rows, "publication_interval_rows")?;
|
||||
options.gpu_class = gpu_class;
|
||||
options.gpu_count = gpu_count
|
||||
.map(|count| {
|
||||
@@ -2206,13 +2210,14 @@ impl Table {
|
||||
})
|
||||
}
|
||||
|
||||
#[pyo3(signature = (column, *, r#where=None, batch_size=None, gpu_class=None, gpu_count=None, retry_policy=None, error_policy=None, max_failed_fraction=None, max_failed_rows=None, row_timeout_seconds=None, init_timeout_seconds=None, num_workers=None, max_executor_processes_per_worker=None))]
|
||||
#[pyo3(signature = (column, *, r#where=None, batch_size=None, publication_interval_rows=None, gpu_class=None, gpu_count=None, retry_policy=None, error_policy=None, max_failed_fraction=None, max_failed_rows=None, row_timeout_seconds=None, init_timeout_seconds=None, num_workers=None, max_executor_processes_per_worker=None))]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn refresh_column(
|
||||
self_: PyRef<'_, Self>,
|
||||
column: String,
|
||||
r#where: Option<String>,
|
||||
batch_size: Option<i64>,
|
||||
publication_interval_rows: Option<i64>,
|
||||
gpu_class: Option<String>,
|
||||
gpu_count: Option<i64>,
|
||||
retry_policy: Option<String>,
|
||||
@@ -2227,6 +2232,7 @@ impl Table {
|
||||
let options = refresh_column_options(RefreshColumnArgs {
|
||||
where_clause: r#where,
|
||||
batch_size,
|
||||
publication_interval_rows,
|
||||
gpu_class,
|
||||
gpu_count,
|
||||
retry_policy,
|
||||
@@ -2248,13 +2254,14 @@ impl Table {
|
||||
})
|
||||
}
|
||||
|
||||
#[pyo3(signature = (column, *, r#where=None, batch_size=None, gpu_class=None, gpu_count=None, retry_policy=None, error_policy=None, max_failed_fraction=None, max_failed_rows=None, row_timeout_seconds=None, init_timeout_seconds=None, num_workers=None, max_executor_processes_per_worker=None))]
|
||||
#[pyo3(signature = (column, *, r#where=None, batch_size=None, publication_interval_rows=None, gpu_class=None, gpu_count=None, retry_policy=None, error_policy=None, max_failed_fraction=None, max_failed_rows=None, row_timeout_seconds=None, init_timeout_seconds=None, num_workers=None, max_executor_processes_per_worker=None))]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn refresh_column_async(
|
||||
self_: PyRef<'_, Self>,
|
||||
column: String,
|
||||
r#where: Option<String>,
|
||||
batch_size: Option<i64>,
|
||||
publication_interval_rows: Option<i64>,
|
||||
gpu_class: Option<String>,
|
||||
gpu_count: Option<i64>,
|
||||
retry_policy: Option<String>,
|
||||
@@ -2269,6 +2276,7 @@ impl Table {
|
||||
let options = refresh_column_options(RefreshColumnArgs {
|
||||
where_clause: r#where,
|
||||
batch_size,
|
||||
publication_interval_rows,
|
||||
gpu_class,
|
||||
gpu_count,
|
||||
retry_policy,
|
||||
|
||||
Generated
+7
-7
@@ -2147,7 +2147,7 @@ requires-dist = [
|
||||
{ name = "pyarrow-stubs", marker = "extra == 'tests'", specifier = ">=16.0" },
|
||||
{ name = "pydantic", specifier = ">=2.7.4,<3" },
|
||||
{ name = "pylance", marker = "extra == 'pylance'", specifier = ">=15.0.0b3" },
|
||||
{ name = "pylance", marker = "extra == 'tests'", specifier = "==15.0.0b15" },
|
||||
{ name = "pylance", marker = "extra == 'tests'", specifier = "==15.0.0b16" },
|
||||
{ name = "pyright", marker = "extra == 'dev'", specifier = ">=1.1.350" },
|
||||
{ name = "pytest", marker = "extra == 'tests'", specifier = ">=7.0" },
|
||||
{ name = "pytest-asyncio", marker = "extra == 'tests'", specifier = ">=0.21" },
|
||||
@@ -4301,7 +4301,7 @@ crypto = [
|
||||
|
||||
[[package]]
|
||||
name = "pylance"
|
||||
version = "15.0.0b15"
|
||||
version = "15.0.0b16"
|
||||
source = { registry = "https://pypi.fury.io/lance-format/" }
|
||||
dependencies = [
|
||||
{ name = "lance-namespace" },
|
||||
@@ -4312,11 +4312,11 @@ dependencies = [
|
||||
{ name = "pyarrow", version = "26.0.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
|
||||
]
|
||||
wheels = [
|
||||
{ url = "https://pypi.fury.io/lance-format/-/ver_29HO58/pylance-15.0.0b15-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:46c870c3d650f911eccb7406ec77f72fa448f80b2f827ff35dd86bbc0b9e08ca" },
|
||||
{ url = "https://pypi.fury.io/lance-format/-/ver_OBkXR/pylance-15.0.0b15-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b3f418584cdee98d27aac538ebe5203051a0b78a98668aff22bc29aebe3dd3c9" },
|
||||
{ url = "https://pypi.fury.io/lance-format/-/ver_TMbLm/pylance-15.0.0b15-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3656d52ba65d297b41f1973d1a3efbb888f761cf7c934ff15e0c1aecc560b2d5" },
|
||||
{ url = "https://pypi.fury.io/lance-format/-/ver_mmYmR/pylance-15.0.0b15-cp310-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:a50d06e3a86d68acf8edf5a83736890a648a16a1cb8c8ccde9ef5b6c82ebef76" },
|
||||
{ url = "https://pypi.fury.io/lance-format/-/ver_1aYiTc/pylance-15.0.0b15-cp310-abi3-win_amd64.whl", hash = "sha256:6451499f0612d0326d54168bedcc6df29c1e0700c4f92902f5f00a6ecdf17745" },
|
||||
{ url = "https://pypi.fury.io/lance-format/-/ver_uZ4Az/pylance-15.0.0b16-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:c4ed0ab9213082d9d8cc93aa09351e84574c76ddefc422a2ad073115bd9a1b43" },
|
||||
{ url = "https://pypi.fury.io/lance-format/-/ver_1nenYa/pylance-15.0.0b16-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7f28f7b757ade1e4b556e788bc77d4ffcc351a9c8c570b35f769c457e9cc13bf" },
|
||||
{ url = "https://pypi.fury.io/lance-format/-/ver_1cb3ns/pylance-15.0.0b16-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:49f358f3ddf33d76567f56d0e4a66c218dc1a2d2f06d37d779e13c87b1c3d9a6" },
|
||||
{ url = "https://pypi.fury.io/lance-format/-/ver_g7LAk/pylance-15.0.0b16-cp310-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:288c1b41f5068990672c8c182b4b79d6389c1a907c59ef6047cbee494d1e34ec" },
|
||||
{ url = "https://pypi.fury.io/lance-format/-/ver_12YRtQ/pylance-15.0.0b16-cp310-abi3-win_amd64.whl", hash = "sha256:fa69acdd0960280f6fe8a83ea992fc92e2ed5a0eeb5159b90493dfc76831f752" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
Reference in New Issue
Block a user