public class OpenDatasetBuilder extends Object
This builder provides a fluent API for opening datasets either directly from a URI or from a LanceNamespace. When using a namespace, the table location and storage options are automatically fetched.
Example usage with URI:
Dataset dataset = Dataset.open()
.uri("s3://bucket/table.lance")
.readOptions(options)
.build();
Example usage with namespace:
Dataset dataset = Dataset.open()
.namespace(myNamespace)
.tableId(Arrays.asList("my_table"))
.build();
| Modifier and Type | Method and Description |
|---|---|
OpenDatasetBuilder |
allocator(org.apache.arrow.memory.BufferAllocator allocator)
Sets the buffer allocator.
|
Dataset |
build()
Opens the dataset with the configured parameters.
|
OpenDatasetBuilder |
ignoreNamespaceTableStorageOptions(boolean ignoreNamespaceTableStorageOptions)
Sets whether to ignore storage options from the namespace's describe_table().
|
OpenDatasetBuilder |
namespace(com.lancedb.lance.namespace.LanceNamespace namespace)
Sets the namespace.
|
OpenDatasetBuilder |
readOptions(ReadOptions options)
Sets the read options.
|
OpenDatasetBuilder |
tableId(List<String> tableId)
Sets the table identifier.
|
OpenDatasetBuilder |
uri(String uri)
Sets the dataset URI.
|
public OpenDatasetBuilder allocator(org.apache.arrow.memory.BufferAllocator allocator)
allocator - Arrow buffer allocatorpublic OpenDatasetBuilder uri(String uri)
Either uri() or namespace()+tableId() must be specified, but not both.
uri - The dataset URI (e.g., "s3://bucket/table.lance" or "file:///path/to/table.lance")public OpenDatasetBuilder namespace(com.lancedb.lance.namespace.LanceNamespace namespace)
Must be used together with tableId(). Either uri() or namespace()+tableId() must be specified, but not both.
namespace - The namespace implementation to fetch table info frompublic OpenDatasetBuilder tableId(List<String> tableId)
Must be used together with namespace(). Either uri() or namespace()+tableId() must be specified, but not both.
tableId - The table identifier (e.g., Arrays.asList("my_table"))public OpenDatasetBuilder readOptions(ReadOptions options)
options - Read optionspublic OpenDatasetBuilder ignoreNamespaceTableStorageOptions(boolean ignoreNamespaceTableStorageOptions)
ignoreNamespaceTableStorageOptions - If true, storage options returned from
describe_table() will be ignored (treated as null)public Dataset build()
If a namespace is configured, this automatically fetches the table location and storage options from the namespace via describe_table().
IllegalArgumentException - if required parameters are missing or invalidCopyright © 2025. All rights reserved.