chore(python): add docstring for limit behavior (#800)

Closes #796
This commit is contained in:
Chang She
2024-04-05 16:25:01 -07:00
committed by Weston Pace
parent 881dfa022b
commit 7581cbb38f
2 changed files with 20 additions and 2 deletions
+12 -2
View File
@@ -260,20 +260,30 @@ class LanceQueryBuilder(ABC):
for row in self.to_arrow().to_pylist()
]
def limit(self, limit: int) -> LanceQueryBuilder:
def limit(self, limit: Union[int, None]) -> LanceQueryBuilder:
"""Set the maximum number of results to return.
Parameters
----------
limit: int
The maximum number of results to return.
By default the query is limited to the first 10.
Call this method and pass 0, a negative value,
or None to remove the limit.
*WARNING* if you have a large dataset, removing
the limit can potentially result in reading a
large amount of data into memory and cause
out of memory issues.
Returns
-------
LanceQueryBuilder
The LanceQueryBuilder object.
"""
self._limit = limit
if limit is None or limit <= 0:
self._limit = None
else:
self._limit = limit
return self
def select(self, columns: list) -> LanceQueryBuilder: