-
lance.LanceDataset.to_table(columns: list[str] | dict[str, str] | None =
None, filter: str | 表达式 | None =None, limit: int | None =None, offset: int | None =None, nearest: dict | None =None, batch_size: int | None =None, batch_readahead: int | None =None, fragment_readahead: int | None =None, scan_in_order: bool | None =None, *, prefilter: bool | None =None, with_row_id: bool | None =None, with_row_address: bool | None =None, use_stats: bool | None =None, fast_search: bool | None =None, full_text_query: str | dict | FullTextQuery | None =None, io_buffer_size: int | None =None, late_materialization: bool | list[str] | None =None, use_scalar_index: bool | None =None, include_deleted_rows: bool | None =None) 表格 将数据作为
pyarrow.Table读入内存- Parameters:
- columns : list of str, or dict of str to str default None¶
要获取的列名列表。 或者列名到SQL表达式的字典。 如果为None或未指定,则获取所有列。
- filter : pa.compute.Expression or str¶
表达式或字符串,必须是一个有效的SQL where子句。有关有效的SQL表达式,请参阅 Lance filter pushdown 。
- limit : int, default None¶
最多获取这么多行。如果为None或未指定,则获取所有行。
- offset : int, default None¶
从这一行开始获取。如果未指定则为0。
- nearest : dict, default None¶
获取与K个最相似向量对应的行。示例:
{ "column": <embedding col name>, "q": <query vector as pa.Float32Array>, "k": 10, "metric": "cosine", "minimum_nprobes": 20, "maximum_nprobes": 50, "refine_factor": 1 }- batch_size : int, optional¶
每次读取的行数。
- io_buffer_size : int, default None¶
IO缓冲区的大小。有关更多信息,请参阅
ScannerBuilder.io_buffer_size。- batch_readahead : int, optional¶
预读取的批次数量。
- fragment_readahead : int, optional¶
预读取的片段数量。
- scan_in_order : bool, optional, default True¶
是否按顺序读取片段和批次。如果为false,吞吐量可能会更高,但批次将无序返回,内存使用可能会增加。
- prefilter : bool, optional, default False¶
在向量搜索之前运行过滤器。
- late_materialization : bool or List[str], default None¶
允许自定义控制延迟物化。更多信息请参阅
ScannerBuilder.late_materialization。- use_scalar_index : bool, default True¶
允许自定义控制标量索引的使用。更多信息请参见
ScannerBuilder.use_scalar_index。- with_row_id : bool, optional, default False¶
返回行ID。
- with_row_address : bool, optional, default False¶
返回行地址
- use_stats : bool, optional, default True¶
在过滤过程中使用统计下推。
- fast_search : bool, optional, default False¶
- full_text_query : str or dict, optional¶
用于搜索的查询字符串,结果将按BM25算法排序。 例如:"hello world"会匹配包含"hello"或"world"的文档。 或者使用包含以下键的字典:
- columns: list[str]
要搜索的列, 目前仅支持在列列表中指定单个列。
- query: str
要搜索的查询字符串。
- include_deleted_rows : bool, optional, default False¶
如果为True,则已被删除但仍存在于片段中的行将被返回。这些行的_rowid列将被设为null。所有其他列将反映磁盘上存储的值,可能不为null。
注意:如果是搜索操作或take操作(包括标量索引扫描),则无法返回已删除的行。
笔记
如果同时指定了filter和nearest,那么:
nearest 会优先执行。
除非将pre-filter设置为True,否则结果会在之后进行过滤。