|
Lance C/C++ Bindings
C ABI and header-only C++ RAII wrappers for the Lance columnar data format
|
#include <lance/detail/declarations.hpp>
Public Member Functions | |
| Dataset | clone_handle () const |
| uint64_t | count_rows () const |
| Number of rows in the dataset. | |
| uint64_t | count_rows (const std::string &filter) const |
| uint64_t | version () const |
| Version of this dataset snapshot. | |
| std::string | uri () const |
| uint64_t | latest_version () const |
| Latest version ID (queries object store). | |
| std::string | metadata_json () const |
| std::string | update_metadata_json (const std::vector< std::pair< std::string, std::optional< std::string > > > &values, MetadataUpdateMode mode=MetadataUpdateMode::Merge) |
| std::string | update_schema_metadata_json (const std::vector< std::pair< std::string, std::optional< std::string > > > &values, MetadataUpdateMode mode=MetadataUpdateMode::Merge) |
| void | update_field_metadata (const std::vector< FieldMetadataUpdate > &updates) |
| std::string | data_storage_version () const |
| bool | has_stable_row_ids () const |
| std::vector< int32_t > | field_ids () const |
| int32_t | resolve_field_id (const FieldReference &field) const |
| std::string | field_path (int32_t field_id) const |
| std::vector< VersionInfo > | versions () const |
| LanceObjectStoreIoStats | io_stats_snapshot () const |
| LanceObjectStoreIoStats | io_stats_incremental () const |
| std::map< std::string, std::string > | config () const |
| std::string | update_config_json (const std::vector< ConfigUpdate > &updates, MetadataUpdateMode mode=MetadataUpdateMode::Merge) |
| void | update_config (const std::vector< ConfigUpdate > &updates) |
| std::string | base_paths_json () const |
| void | add_bases (const std::vector< BasePath > &bases, const AddBasesOptions &options={}) |
| ArrowStream | tracked_files_stream (std::optional< uint64_t > min_version=std::nullopt, TrackedFilesProgressCallback progress={}) const |
| ArrowStream | all_files_stream () const |
| std::optional< Transaction > | read_transaction () const |
| std::optional< Transaction > | read_transaction_by_version (uint64_t version) const |
| VersionDetails | current_version () const |
| std::vector< VersionDetails > | version_details () const |
| std::vector< uint64_t > | version_refs () const |
| Lightweight attached-version refs ordered by version id. | |
| Dataset | checkout (const Ref &reference) const |
| Check out a native ref as an independent dataset snapshot. | |
| Dataset | shallow_clone (const std::string &target_path, const Ref *reference=nullptr, const StorageOptionsAccessor *storage_options=nullptr) const |
| Dataset | deep_clone (const std::string &target_path, const Ref *reference=nullptr, const StorageOptionsAccessor *storage_options=nullptr) const |
| Dataset | create_branch (const std::string &branch_name, const Ref &reference, std::optional< std::vector< std::pair< std::string, std::string > > > storage_opts=std::nullopt) const |
| Dataset | checkout_branch (const std::string &branch_name) const |
| std::string | branches_json () const |
| std::string | get_branch_json (const std::string &branch_name) const |
| JSON object for one native BranchContents value. | |
| std::string | branch_identifier_json () const |
| JSON object for this dataset snapshot's native BranchIdentifier. | |
| void | delete_branch (const std::string &branch_name) const |
| void | force_delete_branch (const std::string &branch_name) const |
| void | replace_branch_metadata (const std::string &branch_name, const std::vector< std::pair< std::string, std::string > > &metadata) const |
| std::vector< TagInfo > | tags () const |
| Snapshot all tags. Entry order is unspecified. | |
| TagInfo | get_tag (const std::string &name) const |
| Fetch one tag by name. | |
| void | create_tag (const std::string &name, const Ref &reference) const |
| Create a tag from a native ref. | |
| void | update_tag (const std::string &name, const Ref &reference) const |
| Update an existing tag to a native ref. Metadata is preserved natively. | |
| void | delete_tag (const std::string &name) const |
| Delete a tag. | |
| void | replace_tag_metadata (const std::string &name, const std::vector< std::pair< std::string, std::string > > &metadata) const |
| std::vector< FieldStatistics > | calculate_data_stats () const |
| RemovalStats | cleanup_old_versions (const CleanupOldVersionsOptions &options) const |
| RemovalStats | cleanup (const CleanupPolicy &policy, const CleanupOperationOptions &operation={}) const |
| CleanupExplanation | explain_cleanup (const CleanupPolicy &policy, const CleanupOperationOptions &operation={}) const |
| void | validate () const |
| uint64_t | count_deleted_rows () const |
| uint64_t | num_small_files (size_t max_rows_per_group) const |
| Dataset | restore (uint64_t version) const |
| uint64_t | delete_rows (const std::string &predicate) |
| uint64_t | update (const std::string &predicate, const std::vector< std::pair< std::string, std::string > > &updates) |
| void | merge (ArrowArrayStream *source, const std::string &left_on) |
| void | merge (ArrowArrayStream *source, const std::string &left_on, const std::string &right_on) |
| LanceMergeInsertResult | merge_insert (const std::vector< std::string > &on_columns, ArrowArrayStream *source, const LanceMergeInsertParams *params=nullptr) |
| LanceMergeInsertResult | upsert (const std::vector< std::string > &on_columns, ArrowArrayStream *source) |
| Convenience: classic upsert (when_matched=UpdateAll, when_not_matched=InsertAll). | |
| void | initialize_mem_wal (const MemWalInitOptions &options) |
| std::optional< MemWalIndexDetails > | mem_wal_index_details () const |
| ShardWriter | mem_wal_writer (const std::string &shard_id, const ShardWriterConfig &config={}) const |
| LanceMergeInsertResult | merge_insert_with_compaction (const std::vector< std::string > &on_columns, ArrowArrayStream *source, const LanceMergeInsertParams *params, const std::vector< CompactedSsTable > &compacted_sstables) |
| LanceCompactionMetrics | compact_files (const LanceCompactionOptions *options=nullptr) |
| LanceCompactionMetrics | compact_files_with_options (const CompactionOptions *options=nullptr) |
| CompactionPlan | plan_compaction (const CompactionOptions *options=nullptr) const |
| Plan native compaction. NULL options select dataset config. | |
| LanceCompactionMetrics | commit_compaction (const std::vector< RewriteResult > &results, const CompactionOptions *options=nullptr) |
| Commit native rewrite results. NULL options select native defaults. | |
| void | optimize_indices (const OptimizeIndicesOptions *options=nullptr) |
| Run native single-process index optimization. NULL uses native defaults. | |
| OptimizeIndicesPlan | plan_optimize_indices (const OptimizeIndicesOptions *options=nullptr) const |
| Plan the native distributed index optimization workflow. | |
| void | commit_optimize_indices (const std::vector< IndexSegmentResult > &results, const OptimizeIndicesOptions *options=nullptr) |
| Commit merged native index segments. | |
| void | migrate_manifest_paths_v2 () |
| Migrate manifest paths to native v2 naming through core. | |
| void | truncate_table () |
Delete every row through native Dataset::truncate_table. | |
| void | drop_columns (const std::vector< std::string > &columns) |
| void | alter_columns (const std::vector< ColumnAlteration > &alterations) |
| void | add_columns_sql (const std::vector< SqlColumn > &columns, uint64_t batch_size=0) |
| void | add_columns_batch_udf (const BatchUDF &udf, std::optional< std::vector< std::string > > read_columns=std::nullopt, std::optional< uint32_t > batch_size=std::nullopt) |
| void | add_columns_batch_udf (const BatchUDFV2 &udf, std::optional< std::vector< std::string > > read_columns=std::nullopt, std::optional< uint32_t > batch_size=std::nullopt) |
| void | add_columns_nulls (const ArrowSchema *schema) |
| void | add_columns_stream (ArrowArrayStream *stream, uint64_t batch_size=0) |
| void | schema (ArrowSchema *out) const |
| Export the schema as an Arrow C Data Interface struct. | |
| DataFile | create_data_file (const std::string &path, std::optional< uint32_t > base_id=std::nullopt) const |
| LanceSchema | native_schema () const |
| Clone the current snapshot schema as an owned native value. | |
| void | take (const uint64_t *indices, size_t num_indices, const std::vector< std::string > &columns, ArrowArrayStream *out) const |
| void | take (const uint64_t *indices, size_t num_indices, ArrowArrayStream *out) const |
| Take all columns with the same stream ownership as the overload above. | |
| ArrowStream | take (const uint64_t *indices, size_t num_indices, const std::vector< std::string > &columns) const |
| ArrowStream | take (const uint64_t *indices, size_t num_indices) const |
| ArrowStream | take (std::span< const uint64_t > indices, const std::vector< std::string > &columns) const |
| ArrowStream | take (std::span< const uint64_t > indices) const |
| void | take_rows (const uint64_t *row_ids, size_t num_row_ids, const std::vector< std::string > &columns, ArrowArrayStream *out) const |
| void | take_rows (std::span< const uint64_t > row_ids, const std::vector< std::string > &columns, ArrowArrayStream *out) const |
| void | take_rows (const uint64_t *row_ids, size_t num_row_ids, ArrowArrayStream *out) const |
| void | take_rows (std::span< const uint64_t > row_ids, ArrowArrayStream *out) const |
| ArrowStream | take_rows (const uint64_t *row_ids, size_t num_row_ids, const std::vector< std::string > &columns) const |
| ArrowStream | take_rows (const uint64_t *row_ids, size_t num_row_ids) const |
| ArrowStream | take_rows (std::span< const uint64_t > row_ids, const std::vector< std::string > &columns) const |
| ArrowStream | take_rows (std::span< const uint64_t > row_ids) const |
| std::vector< std::optional< BlobFile > > | take_blobs (const uint64_t *row_ids, size_t num_row_ids, const std::string &column) const |
| std::vector< std::optional< BlobFile > > | take_blobs_by_indices (const uint64_t *indices, size_t num_indices, const std::string &column) const |
| std::vector< std::optional< BlobFile > > | take_blobs_by_addresses (const uint64_t *row_addresses, size_t num_row_addresses, const std::string &column) const |
| ArrowStream | read_blobs (const std::string &column, BlobRowSelector selector, const std::vector< uint64_t > &rows, const BlobReadOptions &options={}) const |
| ArrowStream | read_blob_ranges (const std::string &column, BlobRowSelector selector, const std::vector< BlobRangeRequest > &requests, const BlobReadOptions &options={}) const |
| Scanner | scan () const |
| Create a Scanner builder for this dataset. | |
| Scanner | scan (const std::vector< std::string > &columns, const std::optional< std::string > &filter=std::nullopt) const |
| Scanner | scan (std::nullopt_t, const std::optional< std::string > &filter=std::nullopt) const |
| Create a Scanner builder for all columns, with an optional SQL filter. | |
| SqlQueryBuilder | sql (const std::string &sql) const |
| DatasetDeltaBuilder | delta () const |
| FtsQueryContext | prepare_fts_query (const std::string &column, const std::string &query, uint32_t max_fuzzy_distance=0, FtsCoverageMode coverage_mode=FtsCoverageMode::Strict) const |
| Compatibility wrapper for an OR Match query. | |
| FtsQueryContext | prepare_fts_match_query (const std::string &column, const std::string &query, FtsMatchOperator match_operator=FtsMatchOperator::Or, uint32_t max_fuzzy_distance=0, FtsCoverageMode coverage_mode=FtsCoverageMode::Strict) const |
| FtsQueryContext | prepare_fts_phrase_query (const std::string &column, const std::string &query, int32_t slop=0, FtsCoverageMode coverage_mode=FtsCoverageMode::Strict) const |
| uint64_t | fragment_count () const |
| Number of fragments in the dataset. | |
| std::vector< uint64_t > | fragment_ids () const |
| Get all fragment IDs. | |
| Fragment | open_fragment (uint64_t fragment_id) const |
| void | create_vector_index (const std::string &column, const LanceVectorIndexParams ¶ms, const std::string &name="", bool replace=false) |
| Create a vector index on a column. | |
| void | create_vector_index_with_progress (const std::string &column, const LanceVectorIndexParams ¶ms, LanceIndexBuildProgressCallback callback, void *callback_ctx, const std::string &name="", bool replace=false) |
| void | create_vector_index_with_options (const std::string &column, const VectorIndexOptions &options, const std::string &name="", bool replace=false) |
| void | create_vector_index_with_options_and_progress (const std::string &column, const VectorIndexOptions &options, LanceIndexBuildProgressCallback callback, void *callback_ctx, const std::string &name="", bool replace=false) |
| void | create_scalar_index (const std::string &column, LanceScalarIndexType index_type, const std::string &name="", const std::string ¶ms_json="", bool replace=false) |
| void | create_scalar_index_with_progress (const std::string &column, LanceScalarIndexType index_type, LanceIndexBuildProgressCallback callback, void *callback_ctx, const std::string &name="", const std::string ¶ms_json="", bool replace=false) |
| void | create_scalar_index_with_options (const std::string &column, LanceScalarIndexType index_type, const ScalarIndexOptions &options, const std::string &index_name="", const std::string ¶ms_json="", bool replace=false) |
| void | create_scalar_index_with_options_and_progress (const std::string &column, LanceScalarIndexType index_type, const ScalarIndexOptions &options, LanceIndexBuildProgressCallback callback, void *callback_ctx, const std::string &index_name="", const std::string ¶ms_json="", bool replace=false) |
| IndexSegmentBuilder | new_scalar_index_segment_builder (const std::string &column, LanceScalarIndexType index_type, const std::string &index_name="", const std::string ¶ms_json="", const LanceIndexSegmentBuildOptions *options=nullptr) const |
| IndexSegmentBuilder | new_scalar_index_segment_builder_with_options (const std::string &column, LanceScalarIndexType index_type, const ScalarIndexOptions &options, const std::string &index_name="", const std::string ¶ms_json="", const LanceIndexSegmentBuildOptions *build_options=nullptr) const |
| Create a scalar segment builder with the additive native train control. | |
| IndexSegmentBuilder | new_vector_index_segment_builder (const std::string &column, const LanceVectorIndexParams ¶ms, const std::string &index_name="", const LanceIndexSegmentBuildOptions *options=nullptr) const |
| Create a single-use builder for an uncommitted vector index segment. | |
| IndexSegmentBuilder | new_vector_index_segment_builder_with_options (const std::string &column, const VectorIndexOptions &options, const std::string &index_name="", std::optional< std::vector< uint32_t > > fragment_ids=std::nullopt, const std::array< uint8_t, 16 > *index_uuid=nullptr) const |
| IndexModel | train_ivf_model (const std::string &column, uint32_t num_partitions, LanceMetricType metric, const std::vector< uint32_t > &fragment_ids={}) const |
| Train shared IVF centroids as an Arrow C Data Interface array/schema. | |
| IndexModel | train_pq_model (const std::string &column, uint32_t num_sub_vectors, uint32_t num_bits, LanceMetricType metric, IndexModel &ivf_centroids, const std::vector< uint32_t > &fragment_ids={}) const |
| IndexModel | train_ivf_model_with_options (const std::string &column, uint32_t num_partitions, LanceMetricType metric, const IndexTrainerOptions &options={}, const std::vector< uint32_t > &fragment_ids={}) const |
| Train IVF centroids with native sample-rate and iteration controls. | |
| IndexModel | train_pq_model_with_options (const std::string &column, uint32_t num_sub_vectors, uint32_t num_bits, LanceMetricType metric, IndexModel &ivf_centroids, const IndexTrainerOptions &options={}, const std::vector< uint32_t > &fragment_ids={}) const |
| Train a PQ codebook with native trainer controls. | |
| std::string | describe_indices_json () const |
| JSON array of every native index description, including system indexes. | |
| std::string | index_statistics_json (const std::string &index_name) |
| IvfModel | get_ivf_model (const std::string &index_name) const |
| Owned IVF model snapshot for the first physical vector segment. | |
| std::optional< IndexModel > | centroids (const std::string &index_name) const |
| Centroids from get_ivf_model(index_name), or nullopt when absent. | |
| ArrowStream | read_index_partition (const std::string &index_name, uint64_t partition_id, bool with_vector=false) const |
| Read one logical IVF partition; the stream owns its native snapshot. | |
| void | drop_index (const std::string &name) |
| Drop an index by name. | |
| void | prewarm_index (const std::string &index_name) const |
| void | prewarm_index_with_options (const std::string &index_name, const IndexPrewarmOptions &options={}) const |
| Prewarm selected segments with native FTS position controls. | |
| uint64_t | index_count () const |
| Number of user indexes (excludes system indexes). | |
| std::string | list_indices_json () const |
| JSON array describing all user indexes. | |
| std::string | index_segments_json () const |
| void | merge_index_metadata (const std::array< uint8_t, 16 > &index_uuid, const std::string &index_type, std::optional< size_t > batch_readhead=std::nullopt, LanceIndexBuildProgressCallback callback=nullptr, void *callback_ctx=nullptr) const |
| Merge distributed Inverted index files. Files only; does not commit. | |
| std::vector< uint8_t > | merge_index_segments (const std::vector< std::vector< uint8_t > > &segment_metadata) const |
| Merge existing uncommitted segments into one uncommitted segment. | |
| uint64_t | index_segment_count (const std::string &index_name) const |
| std::vector< std::array< uint8_t, 16 > > | index_segments (const std::string &index_name) const |
| void | commit_index_segments (const std::string &index_name, const std::string &column, const std::vector< std::vector< uint8_t > > &segment_metadata) |
| const LanceDataset * | c_handle () const |
| Access the underlying C handle (does not transfer ownership). | |
Static Public Member Functions | |
| *static Dataset | open (const std::string &uri, const std::vector< std::pair< std::string, std::string > > &storage_opts={}, uint64_t version=0) |
| static Dataset | open_with_session (const Session &session, const std::string &uri, const std::vector< std::pair< std::string, std::string > > &storage_opts={}, uint64_t version=0) |
| static Dataset | open_with_options (const std::string &uri, const DatasetOpenOptions &options={}, const Session *session=nullptr) |
| static Dataset | open_with_commit_lock (const std::string &uri, const StorageOptionsAccessor *storage_accessor, uint64_t version, const Session *session, const CommitLock *commit_lock) |
| static Dataset | write (const std::string &uri, ArrowArrayStream *stream, WriteMode mode, const std::vector< std::pair< std::string, std::string > > &storage_opts={}) |
| static Dataset | write (const std::string &uri, ArrowArrayStream *stream, WriteMode mode, const WriteParams ¶ms, const std::vector< std::pair< std::string, std::string > > &storage_opts={}) |
| static Dataset | write_with_options (const std::string &uri, ArrowArrayStream *stream, WriteMode mode, const WriteOptions &options, const std::vector< std::pair< std::string, std::string > > &storage_opts={}) |
| static Dataset | write_with_accessor (const std::string &uri, ArrowArrayStream *stream, WriteMode mode, const StorageOptionsAccessor &storage_options_accessor) |
| static Dataset | write_with_params_and_accessor (const std::string &uri, ArrowArrayStream *stream, WriteMode mode, const WriteParams ¶ms, const StorageOptionsAccessor &storage_options_accessor) |
| static Dataset | write_with_options_and_accessor (const std::string &uri, ArrowArrayStream *stream, WriteMode mode, const WriteOptions &options, const StorageOptionsAccessor &storage_options_accessor) |
| static Dataset | write_with_options_with_commit_lock (const std::string &uri, ArrowArrayStream *stream, WriteMode mode, const WriteOptions &options, const StorageOptionsAccessor *storage_accessor, const Session *session, const CommitLock *commit_lock) |
| static Dataset | write_with_native_options (const std::string &uri, ArrowArrayStream *stream, WriteMode mode, const NativeWriteOptions &options) |
| static Transaction | write_uncommitted_with_native_options (const std::string &uri, ArrowArrayStream *stream, WriteMode mode, const NativeWriteOptions &options) |
| static Dataset | open_namespace (const Namespace &ns, const std::vector< std::string > &table_id, const std::vector< std::pair< std::string, std::string > > &storage_opts={}, uint64_t version=0, const Session *session=nullptr) |
| static Dataset | write_namespace (const Namespace &ns, const std::vector< std::string > &table_id, ArrowArrayStream *stream, WriteMode mode, const WriteOptions &options={}, const std::vector< std::pair< std::string, std::string > > &storage_opts={}, const std::optional< std::string > &branch=std::nullopt, const Session *session=nullptr) |
| static Dataset | commit_namespace_uri (const Namespace &ns, const std::vector< std::string > &table_id, const std::string &uri, const Transaction &transaction, const CommitOptions &options={}, const std::vector< std::pair< std::string, std::string > > &storage_opts={}, const Session *session=nullptr) |
| static Transaction | write_uncommitted (const std::string &uri, ArrowArrayStream *stream, WriteMode mode, const UncommittedWriteOptions &options={}, const std::vector< std::pair< std::string, std::string > > &storage_opts={}, const Session *session=nullptr) |
| static Transaction | write_uncommitted_with_accessor (const std::string &uri, ArrowArrayStream *stream, WriteMode mode, const StorageOptionsAccessor &storage_options_accessor, const UncommittedWriteOptions &options={}, const Session *session=nullptr) |
| static Transaction | write_uncommitted_with_commit_lock (const std::string &uri, ArrowArrayStream *stream, WriteMode mode, const UncommittedWriteOptions &options, const StorageOptionsAccessor *storage_accessor, const Session *session, const CommitLock *commit_lock) |
| static Dataset | commit (const std::string &uri, const Transaction &transaction, const CommitOptions &options={}, const std::vector< std::pair< std::string, std::string > > &storage_opts={}, const Session *session=nullptr) |
| static Dataset | commit_with_accessor (const std::string &uri, const Transaction &transaction, const StorageOptionsAccessor &storage_options_accessor, const CommitOptions &options={}, const Session *session=nullptr) |
| static Dataset | commit_with_commit_lock (const std::string &uri, const Transaction &transaction, const CommitOptions &options, const StorageOptionsAccessor *storage_accessor, const Session *session, const CommitLock *commit_lock) |
| static BatchCommitResult | commit_batch (const std::string &uri, const std::vector< std::reference_wrapper< const Transaction > > &transactions, const CommitOptions &options={}, const std::vector< std::pair< std::string, std::string > > &storage_opts={}, const Session *session=nullptr) |
| static BatchCommitResult | commit_batch_with_accessor (const std::string &uri, const std::vector< std::reference_wrapper< const Transaction > > &transactions, const StorageOptionsAccessor &storage_options_accessor, const CommitOptions &options={}, const Session *session=nullptr) |
| static BatchCommitResult | commit_batch_with_commit_lock (const std::string &uri, const std::vector< std::reference_wrapper< const Transaction > > &transactions, const CommitOptions &options, const StorageOptionsAccessor *storage_accessor, const Session *session, const CommitLock *commit_lock) |
Friends | |
| class | Fragment |
Definition at line 3817 of file declarations.hpp.
| void lance::Dataset::add_bases | ( | const std::vector< BasePath > & | bases, |
| const AddBasesOptions & | options = {} ) |
Register native base paths in one add-bases transaction.
id == 0 requests native allocation. name == std::nullopt maps to native None; an engaged empty string is preserved. An empty bases vector follows the native transaction's commit behavior. Transaction properties distinguish native None (unset optional) from Some(empty map) (engaged empty vector). Native duplicate/conflict validation and ID allocation remain authoritative. Throws lance::Error on failure.
| void lance::Dataset::add_columns_batch_udf | ( | const BatchUDF & | udf, |
| std::optional< std::vector< std::string > > | read_columns = std::nullopt, | ||
| std::optional< uint32_t > | batch_size = std::nullopt ) |
Add columns through native NewColumnTransform::BatchUDF.
udf.output_schema is the complete schema of every returned batch and must remain valid for the call. An engaged checkpoint store requires all four callbacks. std::nullopt read columns maps to native None; an engaged empty vector maps to Some(empty). std::nullopt batch size maps to None; std::optional<uint32_t>(0) is forwarded as explicit zero, leaving validation to native.
Callbacks execute synchronously under this handle's exclusive mutation lock. They must not re-enter the same handle; use an independent handle or an existing fragment/scanner snapshot for callback reads. C++ exceptions are contained and converted to native callback errors. Throws lance::Error on failure.
| void lance::Dataset::add_columns_batch_udf | ( | const BatchUDFV2 & | udf, |
| std::optional< std::vector< std::string > > | read_columns = std::nullopt, | ||
| std::optional< uint32_t > | batch_size = std::nullopt ) |
| void lance::Dataset::add_columns_nulls | ( | const ArrowSchema * | schema | ) |
Add all-null columns described by an Arrow schema, committing a new manifest. Metadata-only on non-legacy datasets. Every field in schema must be nullable. The caller owns schema and must keep it alive for the duration of the call; the wrapper does not release it.
Throws lance::Error on failure (invalid schema, non-nullable field, name collision with an existing column, commit conflict, ...). A legacy-format dataset throws with code LANCE_ERR_NOT_SUPPORTED (all-null columns are metadata-only and the legacy format cannot represent them that way).
| void lance::Dataset::add_columns_sql | ( | const std::vector< SqlColumn > & | columns, |
| uint64_t | batch_size = 0 ) |
Add columns computed from SQL expressions over the dataset's existing columns, committing a new manifest. batch_size = 0 uses the upstream default scan batch size.
columns must be non-empty and each entry's name and expression must be non-empty. Throws lance::Error on failure (empty list, empty name/expression, malformed SQL syntax, a reference to a non-existent column, name collision with an existing column, commit conflict, ...).
| void lance::Dataset::add_columns_stream | ( | ArrowArrayStream * | stream, |
| uint64_t | batch_size = 0 ) |
Add columns by splicing precomputed data from an Arrow C stream into the dataset, committing a new manifest. batch_size = 0 uses the upstream default. When non-null, stream is consumed (released) on every return path — including a null-dataset error and when this method throws — so do not use it again afterward. Only a null stream is rejected without consuming anything.
The stream's total row count must match the dataset exactly. Throws lance::Error on failure (row-count mismatch, name collision with an existing column, commit conflict, ...).
| ArrowStream lance::Dataset::all_files_stream | ( | ) | const |
Export the native physical-file stream for the primary dataset root. The returned owner releases the stream exactly once. Throws lance::Error on failure.
| void lance::Dataset::alter_columns | ( | const std::vector< ColumnAlteration > & | alterations | ) |
Apply one or more column alterations (rename / nullability / type change) and commit a new manifest. Rename and nullability-only changes are zero-copy and preserve any indices on the affected columns; a type change rewrites the column's data files and drops any indices that referenced it.
alterations must be non-empty and each entry must request at least one change. Any data_type pointer must remain valid for the duration of this call. Throws lance::Error on failure (empty list, no-op alteration, unknown column, incompatible cast, tightening nullability when NULLs exist, commit conflict, ...).
| std::string lance::Dataset::base_paths_json | ( | ) | const |
Snapshot native base paths as JSON keyed by decimal ID. Each value has id, name, path and is_dataset_root. Throws lance::Error on failure.
| std::string lance::Dataset::branch_identifier_json | ( | ) | const |
JSON object for this dataset snapshot's native BranchIdentifier.
| std::string lance::Dataset::branches_json | ( | ) | const |
JSON object keyed by branch name. Values are native BranchContents serde objects; map order is unspecified.
| const LanceDataset * lance::Dataset::c_handle | ( | ) | const |
Access the underlying C handle (does not transfer ownership).
| std::vector< FieldStatistics > lance::Dataset::calculate_data_stats | ( | ) | const |
Compute per-field data statistics (compressed on-disk byte size) for query planning, ordered by schema field id. Performs I/O over every fragment. Throws lance::Error on failure.
| std::optional< IndexModel > lance::Dataset::centroids | ( | const std::string & | index_name | ) | const |
Centroids from get_ivf_model(index_name), or nullopt when absent.
Check out a native ref as an independent dataset snapshot.
| Dataset lance::Dataset::checkout_branch | ( | const std::string & | branch_name | ) | const |
Check out the latest version of a branch as an independent dataset. Pass "main" for the default branch.
| RemovalStats lance::Dataset::cleanup | ( | const CleanupPolicy & | policy, |
| const CleanupOperationOptions & | operation = {} ) const |
Execute native manual cleanup with an explicit policy. Current versions, tags, referenced branches and unverified files follow Lance core. Throws lance::Error on failure.
| RemovalStats lance::Dataset::cleanup_old_versions | ( | const CleanupOldVersionsOptions & | options | ) | const |
Clean versions older than a relative duration through native Dataset::cleanup_old_versions. Lance core owns the timestamp cutoff. Throws lance::Error on failure.
| Dataset lance::Dataset::clone_handle | ( | ) | const |
Clone this handle as an independent in-memory snapshot.
The returned handle shares this dataset's native snapshot and Arc-backed session, object-store registry, caches, and commit handler, but has its own lock. Cloning performs no storage I/O. Mutating either handle does not change the other's version, schema, or rows, and does not hold the other's lock. Source and clone may be destroyed in either order.
This duplicates an in-memory handle; it is not Lance's on-disk shallow or deep clone operation. Throws lance::Error on failure.
|
static |
Publish one native transaction through the URI's native CommitBuilder. The transaction handle remains valid and is cloned by the C API.
|
static |
Commit native append transactions as one version. Native eligibility and merge semantics apply; non-append batches throw LANCE_ERR_NOT_SUPPORTED.
|
static |
Commit append transactions as one version with a retained dynamic storage-options accessor. The returned dataset retains the accessor and provider; the merged transaction carries transaction metadata only.
|
static |
Commit native append transactions as one version through a foreign commit lock and optional dynamic storage accessor.
| LanceCompactionMetrics lance::Dataset::commit_compaction | ( | const std::vector< RewriteResult > & | results, |
| const CompactionOptions * | options = nullptr ) |
Commit native rewrite results. NULL options select native defaults.
| void lance::Dataset::commit_index_segments | ( | const std::string & | index_name, |
| const std::string & | column, | ||
| const std::vector< std::vector< uint8_t > > & | segment_metadata ) |
Commit previously built uncommitted index segments as one logical index under index_name on column. Each entry of segment_metadata is the protobuf-encoded IndexMetadata produced by IndexSegmentBuilder::execute_uncommitted(). The commit is a single dataset version bump. Every segment must have been built for column. Coexisting vector segments, including retained existing segments, must have compatible metrics, dimensions, sub-index types, and quantizer kinds; independently trained IVF centroids and PQ codebooks may differ. Replacement of existing same-name segments is automatic and coverage-driven: fully covered segments are replaced, disjoint ones are retained as deltas, and partial overlap is rejected. A commit whose index type differs from the existing same-name index replaces that index entirely, so it must cover every current fragment; a partial-coverage type change is rejected. Fully replaced vector segments do not constrain the new metric. Throws lance::Error on validation failures (empty set, duplicate segment UUIDs, overlapping fragment coverage, unknown or mismatched column, incompatible vector segments), leaving the version and index unchanged.
|
static |
Commit a transaction through a namespace-managed table URI using the native external manifest store and existing CommitBuilder semantics.
| void lance::Dataset::commit_optimize_indices | ( | const std::vector< IndexSegmentResult > & | results, |
| const OptimizeIndicesOptions * | options = nullptr ) |
Commit merged native index segments.
|
static |
Publish one native transaction with a retained dynamic storage-options accessor. The returned dataset retains the accessor and provider.
|
static |
Publish one native transaction through a foreign commit lock and optional dynamic storage accessor.
Conflict handling, retries, manifest construction, cancellation and the final version stay native. NULL pointers keep native defaults. The transaction handle remains valid.
| LanceCompactionMetrics lance::Dataset::compact_files | ( | const LanceCompactionOptions * | options = nullptr | ) |
Compact small or deleted-heavy fragments into larger ones, committing a new manifest. A clean dataset is a no-op — all-zero metrics and the version is unchanged. Pass nullptr for upstream defaults. Throws lance::Error on failure (commit conflict, ...).
| LanceCompactionMetrics lance::Dataset::compact_files_with_options | ( | const CompactionOptions * | options = nullptr | ) |
Compact using the complete native options surface. NULL selects CompactionOptions::from_dataset_config.
| std::map< std::string, std::string > lance::Dataset::config | ( | ) | const |
Snapshot the dataset's manifest config map.
The returned map owns copies of all keys and values. The snapshot is independent of this handle. Entry order is unspecified. A config entry containing an embedded NUL byte cannot be represented as a C string and throws with LANCE_ERR_INTERNAL. Throws lance::Error on failure.
| uint64_t lance::Dataset::count_deleted_rows | ( | ) | const |
Count rows hidden by deletion files across all fragments. Throws lance::Error on failure.
| uint64_t lance::Dataset::count_rows | ( | ) | const |
Number of rows in the dataset.
| uint64_t lance::Dataset::count_rows | ( | const std::string & | filter | ) | const |
Number of rows matching filter through native Dataset::count_rows(Some(filter)). An empty string is an explicit filter, not the unfiltered metadata fast path; use count_rows() for native None.
| Dataset lance::Dataset::create_branch | ( | const std::string & | branch_name, |
| const Ref & | reference, | ||
| std::optional< std::vector< std::pair< std::string, std::string > > > | storage_opts = std::nullopt ) const |
Create a native branch from reference.
storage_opts == std::nullopt uses the source dataset's native store params. An explicitly empty vector passes explicit empty object-store params. Native branch creation is a non-atomic shallow clone followed by a BranchContents write; see the C API documentation for zombie recovery.
| DataFile lance::Dataset::create_data_file | ( | const std::string & | path, |
| std::optional< uint32_t > | base_id = std::nullopt ) const |
Create native data-file metadata from an existing Lance file.
path is relative to the selected native data directory. base_id == std::nullopt maps to native None; an engaged value maps to native Some, including zero. Empty paths, missing or malformed files, schema mismatches and unregistered base IDs retain native error timing. The returned snapshot remains valid after this dataset is destroyed.
| void lance::Dataset::create_scalar_index | ( | const std::string & | column, |
| LanceScalarIndexType | index_type, | ||
| const std::string & | name = "", | ||
| const std::string & | params_json = "", | ||
| bool | replace = false ) |
Create a scalar index on a column. An empty params_json selects the native plugin defaults (the wrapper passes NULL); a non-empty value is forwarded unchanged as JSON.
| void lance::Dataset::create_scalar_index_with_options | ( | const std::string & | column, |
| LanceScalarIndexType | index_type, | ||
| const ScalarIndexOptions & | options, | ||
| const std::string & | index_name = "", | ||
| const std::string & | params_json = "", | ||
| bool | replace = false ) |
Create a scalar index with the additive native train control. params_json follows create_scalar_index: empty selects plugin defaults and a non-empty value is forwarded unchanged as JSON.
| void lance::Dataset::create_scalar_index_with_options_and_progress | ( | const std::string & | column, |
| LanceScalarIndexType | index_type, | ||
| const ScalarIndexOptions & | options, | ||
| LanceIndexBuildProgressCallback | callback, | ||
| void * | callback_ctx, | ||
| const std::string & | index_name = "", | ||
| const std::string & | params_json = "", | ||
| bool | replace = false ) |
Create a scalar index with native train controls and optional progress. A null callback disables observation. The callback follows the same synchronous lifetime and non-reentrancy rules as create_vector_index_with_progress. params_json follows create_scalar_index.
| void lance::Dataset::create_scalar_index_with_progress | ( | const std::string & | column, |
| LanceScalarIndexType | index_type, | ||
| LanceIndexBuildProgressCallback | callback, | ||
| void * | callback_ctx, | ||
| const std::string & | name = "", | ||
| const std::string & | params_json = "", | ||
| bool | replace = false ) |
Create a scalar index with optional progress. A null callback disables observation; a non-null callback has the same synchronous lifetime and non-reentrancy rules as create_vector_index_with_progress. params_json follows create_scalar_index.
| void lance::Dataset::create_tag | ( | const std::string & | name, |
| const Ref & | reference ) const |
Create a tag from a native ref.
| void lance::Dataset::create_vector_index | ( | const std::string & | column, |
| const LanceVectorIndexParams & | params, | ||
| const std::string & | name = "", | ||
| bool | replace = false ) |
Create a vector index on a column.
| void lance::Dataset::create_vector_index_with_options | ( | const std::string & | column, |
| const VectorIndexOptions & | options, | ||
| const std::string & | name = "", | ||
| bool | replace = false ) |
Create a vector index from additive native options.
Native Lance performs the commit before reloading index metadata. An exception can therefore be thrown after the dataset version was published; reopen the dataset to determine its current version.
| void lance::Dataset::create_vector_index_with_options_and_progress | ( | const std::string & | column, |
| const VectorIndexOptions & | options, | ||
| LanceIndexBuildProgressCallback | callback, | ||
| void * | callback_ctx, | ||
| const std::string & | name = "", | ||
| bool | replace = false ) |
Create a vector index from additive native options with optional progress. See create_vector_index_with_progress for the callback and publication-error contract.
| void lance::Dataset::create_vector_index_with_progress | ( | const std::string & | column, |
| const LanceVectorIndexParams & | params, | ||
| LanceIndexBuildProgressCallback | callback, | ||
| void * | callback_ctx, | ||
| const std::string & | name = "", | ||
| bool | replace = false ) |
Create a vector index from legacy parameters with optional progress.
A null callback disables observation. A non-null callback may run concurrently on internal runtime worker threads while this call holds the dataset mutation lock; it must be thread-safe, non-blocking, and must not access this dataset, call runtime-backed lance_* entry points, or start a nested runtime. Non-runtime leaf utilities are unaffected. The callback and context are borrowed only through this synchronous call and are retired before it returns. Native publication/reload errors can leave the returned state uncertain; reopen to inspect the version.
| VersionDetails lance::Dataset::current_version | ( | ) | const |
Current version details, including native nanosecond timestamp and manifest-summary metadata. Timestamps must fit i64 nanoseconds. Throws lance::Error on failure.
| std::string lance::Dataset::data_storage_version | ( | ) | const |
Current snapshot's canonical native Lance data-storage version string. Throws lance::Error on failure.
| Dataset lance::Dataset::deep_clone | ( | const std::string & | target_path, |
| const Ref * | reference = nullptr, | ||
| const StorageOptionsAccessor * | storage_options = nullptr ) const |
Deep clone this handle's snapshot into target_path.
reference == nullptr clones the handle's current snapshot (branch and version id pinned); it does not select the latest head. Pass Ref::version(std::nullopt, std::nullopt) to clone the current head of the default branch. storage_options == nullptr passes native None; otherwise the accessor's native Arc is forwarded as-is when it holds static options or a provider (an accessor with neither passes None), without resolving or copying credentials. The returned dataset keeps the cloned snapshot's version id (native clone commit semantics), so version() is not necessarily 1. Copy or commit errors can leave the target's publication state uncertain; reopen it to check its state. Partial objects may remain under target_path and are not rolled back. The target URI must use a scheme known to the default object-store registry, because native clone commits resolve it there. For datasets with additional base paths, native deep clone reads them through the source dataset's object store; per-base distinct source credentials are not supported.
| void lance::Dataset::delete_branch | ( | const std::string & | branch_name | ) | const |
Delete a branch. Child-branch and tag references surface as LANCE_ERR_COMMIT_CONFLICT.
| uint64_t lance::Dataset::delete_rows | ( | const std::string & | predicate | ) |
Delete rows matching the SQL predicate, committing a new manifest. Mutates this dataset in place; the handle continues to point at the new version. Returns the number of rows that were deleted. Throws lance::Error on failure (empty predicate, malformed SQL, commit conflict, ...).
Named delete_rows to avoid the C++ delete keyword.
| void lance::Dataset::delete_tag | ( | const std::string & | name | ) | const |
Delete a tag.
| DatasetDeltaBuilder lance::Dataset::delta | ( | ) | const |
Explore row changes between dataset versions with the native dataset::delta support. The returned builder owns its own dataset snapshot. Version and date ranges are validated synchronously on build; transaction listing and the four row-change streams are native.
| std::string lance::Dataset::describe_indices_json | ( | ) | const |
JSON array of every native index description, including system indexes.
| void lance::Dataset::drop_columns | ( | const std::vector< std::string > & | columns | ) |
Drop columns from the dataset's schema and commit a new manifest. Metadata-only — data files remain until a later compact_files() call rewrites them. Mutates this dataset in place; the handle continues to point at the new version.
columns must be non-empty. Throws lance::Error on failure (empty list, unknown column, attempt to drop every column, commit conflict, ...).
| void lance::Dataset::drop_index | ( | const std::string & | name | ) |
Drop an index by name.
| CleanupExplanation lance::Dataset::explain_cleanup | ( | const CleanupPolicy & | policy, |
| const CleanupOperationOptions & | operation = {} ) const |
Explain cleanup without deleting files. The returned value owns copies of every native field and remains valid after this Dataset is closed. A later cleanup re-evaluates current references and storage state. Throws lance::Error on failure.
| std::vector< int32_t > lance::Dataset::field_ids | ( | ) | const |
Field IDs in the current schema's native pre-order traversal. Throws lance::Error on failure.
| std::string lance::Dataset::field_path | ( | int32_t | field_id | ) | const |
Native minimal Lance field path for field_id, including nested fields. Throws lance::Error on failure.
| void lance::Dataset::force_delete_branch | ( | const std::string & | branch_name | ) | const |
Delete a branch while bypassing only a missing BranchContents. Native child-branch and tag reference checks still apply.
| uint64_t lance::Dataset::fragment_count | ( | ) | const |
Number of fragments in the dataset.
| std::vector< uint64_t > lance::Dataset::fragment_ids | ( | ) | const |
Get all fragment IDs.
| std::string lance::Dataset::get_branch_json | ( | const std::string & | branch_name | ) | const |
JSON object for one native BranchContents value.
| IvfModel lance::Dataset::get_ivf_model | ( | const std::string & | index_name | ) | const |
Owned IVF model snapshot for the first physical vector segment.
| TagInfo lance::Dataset::get_tag | ( | const std::string & | name | ) | const |
Fetch one tag by name.
| bool lance::Dataset::has_stable_row_ids | ( | ) | const |
Whether the current snapshot uses stable row IDs. Throws lance::Error on failure.
| uint64_t lance::Dataset::index_count | ( | ) | const |
Number of user indexes (excludes system indexes).
| uint64_t lance::Dataset::index_segment_count | ( | const std::string & | index_name | ) | const |
Number of segments that make up a logical vector index. Throws lance::Error with code NotFound if the index does not exist.
| std::vector< std::array< uint8_t, 16 > > lance::Dataset::index_segments | ( | const std::string & | index_name | ) | const |
UUIDs of the physical segments that make up a logical vector index. Each UUID is a 16-byte array (RFC 4122 layout). Used by distributed query engines to fan k-NN out across workers — see Scanner::index_segments.
| std::string lance::Dataset::index_segments_json | ( | ) | const |
JSON array with one entry per non-system physical index segment. Each entry includes the recorded fragment coverage and physical index format version. fragment_ids is null for unknown coverage and empty for known-empty coverage; historical fragment IDs are reported as recorded. Throws lance::Error on failure.
| std::string lance::Dataset::index_statistics_json | ( | const std::string & | index_name | ) |
Native index-family-specific statistics JSON. May publish a native migration version for old corrupt fragment coverage.
| void lance::Dataset::initialize_mem_wal | ( | const MemWalInitOptions & | options | ) |
Initialize native MemWAL on this dataset. The handle is updated in place; existing scanners keep their previous snapshot. Sharding mode, column, bucket bounds, maintained index names, and writer defaults are validated by native code.
| LanceObjectStoreIoStats lance::Dataset::io_stats_incremental | ( | ) | const |
Return dataset object-store counters accumulated since the previous incremental call and reset the native accumulator. No binding-side baseline is kept.
| LanceObjectStoreIoStats lance::Dataset::io_stats_snapshot | ( | ) | const |
Snapshot the dataset's native object-store I/O counters without resetting them. The counters are the current native accumulator for the store returned by Dataset::object_store(None); a preceding incremental call resets that accumulator.
| uint64_t lance::Dataset::latest_version | ( | ) | const |
Latest version ID (queries object store).
| std::string lance::Dataset::list_indices_json | ( | ) | const |
JSON array describing all user indexes.
| std::optional< MemWalIndexDetails > lance::Dataset::mem_wal_index_details | ( | ) | const |
Read native MemWAL index details. Returns nullopt when MemWAL is not initialized on the current snapshot.
| ShardWriter lance::Dataset::mem_wal_writer | ( | const std::string & | shard_id, |
| const ShardWriterConfig & | config = {} ) const |
Open a native shard writer. The supplied shard ID must be a UUID; config overrides native defaults for this writer only.
| void lance::Dataset::merge | ( | ArrowArrayStream * | source, |
| const std::string & | left_on ) |
One-shot native Dataset::merge left join. The two-argument overload maps an omitted right_on to left_on.
A non-null source is consumed on return or throw; a null source is rejected without consumption. Native owns matching, schema union, and commit behavior. Existing scanners and independently opened handles retain their previous snapshots. Throws lance::Error on failure.
| void lance::Dataset::merge | ( | ArrowArrayStream * | source, |
| const std::string & | left_on, | ||
| const std::string & | right_on ) |
One-shot native Dataset::merge left join with distinct keys.
Duplicate right-side join keys, including duplicate nulls, are rejected by native with LANCE_ERR_INVALID_ARGUMENT. Empty key strings are forwarded to native validation. Throws lance::Error on failure.
| void lance::Dataset::merge_index_metadata | ( | const std::array< uint8_t, 16 > & | index_uuid, |
| const std::string & | index_type, | ||
| std::optional< size_t > | batch_readhead = std::nullopt, | ||
| LanceIndexBuildProgressCallback | callback = nullptr, | ||
| void * | callback_ctx = nullptr ) const |
Merge distributed Inverted index files. Files only; does not commit.
| std::vector< uint8_t > lance::Dataset::merge_index_segments | ( | const std::vector< std::vector< uint8_t > > & | segment_metadata | ) | const |
Merge existing uncommitted segments into one uncommitted segment.
| LanceMergeInsertResult lance::Dataset::merge_insert | ( | const std::vector< std::string > & | on_columns, |
| ArrowArrayStream * | source, | ||
| const LanceMergeInsertParams * | params = nullptr ) |
Merge source into this dataset keyed on on_columns, committing a new manifest. Defaults to find-or-create semantics (insert rows that do not match an existing key). Returns the per-call insert / update / delete counts.
on_columns must be non-empty. params controls match behavior; pass nullptr for find-or-create defaults. source is consumed. Throws lance::Error on failure (empty key, schema mismatch, malformed SQL, missing expression for *_IF mode, commit conflict, ...).
| LanceMergeInsertResult lance::Dataset::merge_insert_with_compaction | ( | const std::vector< std::string > & | on_columns, |
| ArrowArrayStream * | source, | ||
| const LanceMergeInsertParams * | params, | ||
| const std::vector< CompactedSsTable > & | compacted_sstables ) |
Merge source and atomically advance MemWAL compaction progress. source is consumed on return or throw. An empty list is a plain merge.
| std::string lance::Dataset::metadata_json | ( | ) | const |
Table metadata for this snapshot as a JSON object. Schema metadata is available through schema() instead. Throws lance::Error on failure.
| void lance::Dataset::migrate_manifest_paths_v2 | ( | ) |
Migrate manifest paths to native v2 naming through core.
| LanceSchema lance::Dataset::native_schema | ( | ) | const |
Clone the current snapshot schema as an owned native value.
| IndexSegmentBuilder lance::Dataset::new_scalar_index_segment_builder | ( | const std::string & | column, |
| LanceScalarIndexType | index_type, | ||
| const std::string & | index_name = "", | ||
| const std::string & | params_json = "", | ||
| const LanceIndexSegmentBuildOptions * | options = nullptr ) const |
Create a single-use builder for an uncommitted scalar index segment. The builder owns a snapshot, so it remains valid independently of this Dataset object's lifetime.
| IndexSegmentBuilder lance::Dataset::new_scalar_index_segment_builder_with_options | ( | const std::string & | column, |
| LanceScalarIndexType | index_type, | ||
| const ScalarIndexOptions & | options, | ||
| const std::string & | index_name = "", | ||
| const std::string & | params_json = "", | ||
| const LanceIndexSegmentBuildOptions * | build_options = nullptr ) const |
Create a scalar segment builder with the additive native train control.
| IndexSegmentBuilder lance::Dataset::new_vector_index_segment_builder | ( | const std::string & | column, |
| const LanceVectorIndexParams & | params, | ||
| const std::string & | index_name = "", | ||
| const LanceIndexSegmentBuildOptions * | options = nullptr ) const |
Create a single-use builder for an uncommitted vector index segment.
| IndexSegmentBuilder lance::Dataset::new_vector_index_segment_builder_with_options | ( | const std::string & | column, |
| const VectorIndexOptions & | options, | ||
| const std::string & | index_name = "", | ||
| std::optional< std::vector< uint32_t > > | fragment_ids = std::nullopt, | ||
| const std::array< uint8_t, 16 > * | index_uuid = nullptr ) const |
Create a single-use vector segment builder from additive native options. fragment_ids == std::nullopt preserves native None; an engaged empty vector preserves Some(empty). Native validation decides duplicate and missing-ID behavior and timing.
| uint64_t lance::Dataset::num_small_files | ( | size_t | max_rows_per_group | ) | const |
Count fragments with fewer physical rows than max_rows_per_group. Native max_rows_per_group == 0 returns 0. Throws lance::Error only for binding input errors.
|
static |
Open a dataset at the given URI. Pass version = 0 (the default) for the latest, or a specific version id from versions() to check out that version, e.g. `lanceDataset::open("data.lance", {}, /*version=
| Fragment lance::Dataset::open_fragment | ( | uint64_t | fragment_id | ) | const |
Resolve a read-only fragment snapshot by ID. The returned handle stays bound to this dataset version and remains valid after this Dataset is destroyed. A missing ID throws LANCE_ERR_NOT_FOUND.
|
static |
Open through a native namespace. Namespace location/storage options and managed-version behavior follow DatasetBuilder::from_namespace.
|
static |
Open through a foreign commit lock and optional dynamic storage accessor.
The returned dataset retains the native handler and accessor owners, so destroying either input afterwards does not invalidate this dataset, its scanners, or later commits. NULL pointers keep native defaults.
|
static |
Open a dataset with additive options and an optional shared session.
A NULL storage_options_accessor selects native storage defaults. A non-NULL accessor is retained by the returned dataset, so the C++ wrapper may be destroyed immediately after this call; later I/O uses the native provider refresh, error and cache policy.
|
static |
Open a dataset with caches owned by session. The returned dataset remains valid if the Session wrapper is destroyed first.
| void lance::Dataset::optimize_indices | ( | const OptimizeIndicesOptions * | options = nullptr | ) |
Run native single-process index optimization. NULL uses native defaults.
| CompactionPlan lance::Dataset::plan_compaction | ( | const CompactionOptions * | options = nullptr | ) | const |
Plan native compaction. NULL options select dataset config.
| OptimizeIndicesPlan lance::Dataset::plan_optimize_indices | ( | const OptimizeIndicesOptions * | options = nullptr | ) | const |
Plan the native distributed index optimization workflow.
| FtsQueryContext lance::Dataset::prepare_fts_match_query | ( | const std::string & | column, |
| const std::string & | query, | ||
| FtsMatchOperator | match_operator = FtsMatchOperator::Or, | ||
| uint32_t | max_fuzzy_distance = 0, | ||
| FtsCoverageMode | coverage_mode = FtsCoverageMode::Strict ) const |
Prepare a Match query with a global BM25 scorer. AND and OR are supported. max_fuzzy_distance is reserved and currently must be zero; keeping it here avoids another API change when canonical cross-segment fuzzy vocabulary injection becomes available.
| FtsQueryContext lance::Dataset::prepare_fts_phrase_query | ( | const std::string & | column, |
| const std::string & | query, | ||
| int32_t | slop = 0, | ||
| FtsCoverageMode | coverage_mode = FtsCoverageMode::Strict ) const |
Prepare a Phrase query. Its FTS index must store token positions and slop must be non-negative.
| FtsQueryContext lance::Dataset::prepare_fts_query | ( | const std::string & | column, |
| const std::string & | query, | ||
| uint32_t | max_fuzzy_distance = 0, | ||
| FtsCoverageMode | coverage_mode = FtsCoverageMode::Strict ) const |
Compatibility wrapper for an OR Match query.
| void lance::Dataset::prewarm_index | ( | const std::string & | index_name | ) | const |
Synchronously prewarm all segments of an index in this snapshot. Uses the dataset's session index cache; entries remain evictable. Throws lance::Error on failure, including an absent or empty index name.
| void lance::Dataset::prewarm_index_with_options | ( | const std::string & | index_name, |
| const IndexPrewarmOptions & | options = {} ) const |
Prewarm selected segments with native FTS position controls.
| ArrowStream lance::Dataset::read_blob_ranges | ( | const std::string & | column, |
| BlobRowSelector | selector, | ||
| const std::vector< BlobRangeRequest > & | requests, | ||
| const BlobReadOptions & | options = {} ) const |
Plan and stream one blob-local range read per request. Returns the existing move-only ArrowStream. Each record contains request_index, row_address, offset, length and nullable LargeBinary data. request_index identifies duplicate/unordered requests. The stream remains valid after this Dataset is destroyed. Native payload bytes are retained directly in Arrow buffers without a payload copy; exported batches remain valid after the stream is released.
| ArrowStream lance::Dataset::read_blobs | ( | const std::string & | column, |
| BlobRowSelector | selector, | ||
| const std::vector< uint64_t > & | rows, | ||
| const BlobReadOptions & | options = {} ) const |
Plan and stream whole-blob reads. Returns the existing move-only ArrowStream. Each stream record contains row_address and nullable LargeBinary data; native order, duplicates and NULL-versus-empty values are preserved. The stream remains valid after this Dataset is destroyed. Native payload bytes are retained directly in Arrow buffers without a payload copy; exported batches remain valid after the stream is released.
| ArrowStream lance::Dataset::read_index_partition | ( | const std::string & | index_name, |
| uint64_t | partition_id, | ||
| bool | with_vector = false ) const |
Read one logical IVF partition; the stream owns its native snapshot.
| std::optional< Transaction > lance::Dataset::read_transaction | ( | ) | const |
Read this snapshot's native transaction. Returns nullopt when the manifest has no transaction file. The result is independent of this Dataset handle.
| std::optional< Transaction > lance::Dataset::read_transaction_by_version | ( | uint64_t | version | ) | const |
Read a specific version's native transaction. Returns nullopt when that version has no transaction file. Missing versions follow native errors.
| void lance::Dataset::replace_branch_metadata | ( | const std::string & | branch_name, |
| const std::vector< std::pair< std::string, std::string > > & | metadata ) const |
Replace all metadata entries on a branch. An empty vector writes an empty map; this is not a merge or NULL-delete operation.
| void lance::Dataset::replace_tag_metadata | ( | const std::string & | name, |
| const std::vector< std::pair< std::string, std::string > > & | metadata ) const |
Replace all metadata entries on a tag. An empty map writes empty metadata; native reads treat absent and empty metadata the same.
| int32_t lance::Dataset::resolve_field_id | ( | const FieldReference & | field | ) | const |
Resolve a field reference against the current snapshot's schema. Throws lance::Error on an unknown ID or path.
| Dataset lance::Dataset::restore | ( | uint64_t | version | ) | const |
Commit a new manifest carrying the fragments of version, even when version is already the latest. The returned Dataset points at the newly committed version; this handle is unchanged. Throws lance::Error on failure.
| Scanner lance::Dataset::scan | ( | const std::vector< std::string > & | columns, |
| const std::optional< std::string > & | filter = std::nullopt ) const |
Create a Scanner builder with an explicit column projection and optional primary SQL filter. An empty projection selects zero columns. A supplied filter is forwarded verbatim, including an empty expression. Invalid projections or filters are reported when the scanner is materialized.
| Scanner lance::Dataset::scan | ( | std::nullopt_t | , |
| const std::optional< std::string > & | filter = std::nullopt ) const |
Create a Scanner builder for all columns, with an optional SQL filter.
| void lance::Dataset::schema | ( | ArrowSchema * | out | ) | const |
Export the schema as an Arrow C Data Interface struct.
| Dataset lance::Dataset::shallow_clone | ( | const std::string & | target_path, |
| const Ref * | reference = nullptr, | ||
| const StorageOptionsAccessor * | storage_options = nullptr ) const |
Shallow clone this handle's snapshot into target_path.
Native Dataset::shallow_clone publishes a metadata-only target that reuses the source base paths instead of copying data files. reference == nullptr clones the handle's current snapshot (branch and version id pinned); it does not select the latest head. Pass Ref::version(std::nullopt, std::nullopt) to clone the current head of the default branch. storage_options == nullptr passes native None, which inherits the source dataset-level store params as native shallow clone does; otherwise the accessor's native Arc is forwarded as-is when it holds static options or a provider (an accessor with neither passes None), without resolving or copying credentials.
The target is resolved through the source handle's session registry. The returned dataset retains runtime source store params for its base paths, so it can read shared source files after the source handle is closed. Those params are not persisted: a later reopen needs DatasetOpenOptions::base_store_params when the default store configuration cannot read a base. A target with a published dataset is rejected before writes; later failures may leave partial files, including tagged index files, without rollback. No reopen, credential persistence, cloud guarantee, or custom ObjectStore API is added here.
| SqlQueryBuilder lance::Dataset::sql | ( | const std::string & | sql | ) | const |
Plan a SQL query over this dataset with the native dataset::sql planner. sql is copied; the returned builder owns its own dataset snapshot, so this dataset handle may close first. System-column injection, batch limits and blob handling are configured on the builder; the native planner owns their semantics.
| std::vector< TagInfo > lance::Dataset::tags | ( | ) | const |
Snapshot all tags. Entry order is unspecified.
| ArrowStream lance::Dataset::take | ( | const uint64_t * | indices, |
| size_t | num_indices ) const |
Take all columns by indices and return the owning stream. Ownership and validation follow the projecting overload above.
| void lance::Dataset::take | ( | const uint64_t * | indices, |
| size_t | num_indices, | ||
| ArrowArrayStream * | out ) const |
Take all columns with the same stream ownership as the overload above.
| ArrowStream lance::Dataset::take | ( | const uint64_t * | indices, |
| size_t | num_indices, | ||
| const std::vector< std::string > & | columns ) const |
Take rows by indices and return the owning stream.
The projection, empty-vector behavior and native validation are the same as the raw-out overload. The returned ArrowStream releases the native stream exactly once, on destruction or reset(); moving it transfers ownership and leaves the source empty. out from the raw-out overload remains caller-owned.
| void lance::Dataset::take | ( | const uint64_t * | indices, |
| size_t | num_indices, | ||
| const std::vector< std::string > & | columns, | ||
| ArrowArrayStream * | out ) const |
Take rows by indices. out is caller-owned and its non-null release must be called exactly once. Deferred iteration/cleanup panics are contained by the exported stream guard.
| ArrowStream lance::Dataset::take | ( | std::span< const uint64_t > | indices | ) | const |
Borrow all-column indices from a contiguous range and return the owning stream. Ownership follows the overload above.
| ArrowStream lance::Dataset::take | ( | std::span< const uint64_t > | indices, |
| const std::vector< std::string > & | columns ) const |
Borrow indices from a contiguous range and return the owning stream. The range is read only during this call. Empty-range and projection behavior are inherited from the pointer/count overload above.
| std::vector< std::optional< BlobFile > > lance::Dataset::take_blobs | ( | const uint64_t * | row_ids, |
| size_t | num_row_ids, | ||
| const std::string & | column ) const |
Take blob handles by dataset row ID; element i is for row_ids[i], std::nullopt for a null blob value.
| std::vector< std::optional< BlobFile > > lance::Dataset::take_blobs_by_addresses | ( | const uint64_t * | row_addresses, |
| size_t | num_row_addresses, | ||
| const std::string & | column ) const |
Take blob handles by physical row address; element i is for row_addresses[i], std::nullopt for a null blob value. An empty selection still validates column through native.
| std::vector< std::optional< BlobFile > > lance::Dataset::take_blobs_by_indices | ( | const uint64_t * | indices, |
| size_t | num_indices, | ||
| const std::string & | column ) const |
Take blob handles by 0-based row index, with the same ownership and null-slot semantics as the overload above.
| ArrowStream lance::Dataset::take_rows | ( | const uint64_t * | row_ids, |
| size_t | num_row_ids ) const |
Take all columns by dataset row IDs and return the owning stream. Ownership and validation follow the projecting overload above.
| void lance::Dataset::take_rows | ( | const uint64_t * | row_ids, |
| size_t | num_row_ids, | ||
| ArrowArrayStream * | out ) const |
Take all columns by dataset row IDs with the same stream ownership as the overload above.
| ArrowStream lance::Dataset::take_rows | ( | const uint64_t * | row_ids, |
| size_t | num_row_ids, | ||
| const std::vector< std::string > & | columns ) const |
Take rows by dataset row IDs and return the owning stream.
The projection, empty-vector behavior and native validation are the same as the raw-out overload. The returned ArrowStream releases the native stream exactly once, on destruction or reset(); moving it transfers ownership and leaves the source empty. out from the raw-out overload remains caller-owned.
| void lance::Dataset::take_rows | ( | const uint64_t * | row_ids, |
| size_t | num_row_ids, | ||
| const std::vector< std::string > & | columns, | ||
| ArrowArrayStream * | out ) const |
Take rows by dataset row IDs. out is caller-owned and its non-null release must be called exactly once. Deferred iteration/cleanup panics are contained by the exported stream guard.
| ArrowStream lance::Dataset::take_rows | ( | std::span< const uint64_t > | row_ids | ) | const |
Borrow all-column row IDs from a contiguous range and return the owning stream. Ownership follows the overload above.
| void lance::Dataset::take_rows | ( | std::span< const uint64_t > | row_ids, |
| ArrowArrayStream * | out ) const |
Borrow all-column row IDs with the same range lifetime, empty-range and stream-ownership rules as the span overload above.
| ArrowStream lance::Dataset::take_rows | ( | std::span< const uint64_t > | row_ids, |
| const std::vector< std::string > & | columns ) const |
Borrow row IDs from a contiguous range and return the owning stream. The range is read only during this call. Empty-range and projection behavior are inherited from the pointer/count overload above.
| void lance::Dataset::take_rows | ( | std::span< const uint64_t > | row_ids, |
| const std::vector< std::string > & | columns, | ||
| ArrowArrayStream * | out ) const |
Borrow row IDs from a contiguous range. Accepted sources include std::span, std::vector, std::array and C arrays; the range is only read during this call, so no copy or lifetime extension is required. An empty range, including one whose data() is null, produces an empty stream. out has the same ownership as the pointer/count overload.
| ArrowStream lance::Dataset::tracked_files_stream | ( | std::optional< uint64_t > | min_version = std::nullopt, |
| TrackedFilesProgressCallback | progress = {} ) const |
Export the native tracked-files stream. The returned owner releases the stream exactly once. The optional progress callback's capture is owned until the native emitter releases it, which can follow stream cleanup.
| IndexModel lance::Dataset::train_ivf_model | ( | const std::string & | column, |
| uint32_t | num_partitions, | ||
| LanceMetricType | metric, | ||
| const std::vector< uint32_t > & | fragment_ids = {} ) const |
Train shared IVF centroids as an Arrow C Data Interface array/schema.
| IndexModel lance::Dataset::train_ivf_model_with_options | ( | const std::string & | column, |
| uint32_t | num_partitions, | ||
| LanceMetricType | metric, | ||
| const IndexTrainerOptions & | options = {}, | ||
| const std::vector< uint32_t > & | fragment_ids = {} ) const |
Train IVF centroids with native sample-rate and iteration controls.
| IndexModel lance::Dataset::train_pq_model | ( | const std::string & | column, |
| uint32_t | num_sub_vectors, | ||
| uint32_t | num_bits, | ||
| LanceMetricType | metric, | ||
| IndexModel & | ivf_centroids, | ||
| const std::vector< uint32_t > & | fragment_ids = {} ) const |
Train a shared PQ codebook as an Arrow C Data Interface array/schema. L2 and cosine use IVF residuals; DOT trains on raw vectors.
| IndexModel lance::Dataset::train_pq_model_with_options | ( | const std::string & | column, |
| uint32_t | num_sub_vectors, | ||
| uint32_t | num_bits, | ||
| LanceMetricType | metric, | ||
| IndexModel & | ivf_centroids, | ||
| const IndexTrainerOptions & | options = {}, | ||
| const std::vector< uint32_t > & | fragment_ids = {} ) const |
Train a PQ codebook with native trainer controls.
| void lance::Dataset::truncate_table | ( | ) |
Delete every row through native Dataset::truncate_table.
| uint64_t lance::Dataset::update | ( | const std::string & | predicate, |
| const std::vector< std::pair< std::string, std::string > > & | updates ) |
Update rows matching the SQL predicate by applying per-column SQL expressions. Mutates this dataset in place; the handle continues to point at the new version. Returns the number of rows updated.
predicate is empty -> updates every row (passed as NULL to the C API). updates must be non-empty; each pair is {column_name, / sql_expr}. Throws lance::Error on failure (empty pair entry, malformed SQL, unknown column, commit conflict, ...).
| void lance::Dataset::update_config | ( | const std::vector< ConfigUpdate > & | updates | ) |
Apply native merge-style config updates, committing a new manifest. Existing callers keep the original void-returning contract.
| std::string lance::Dataset::update_config_json | ( | const std::vector< ConfigUpdate > & | updates, |
| MetadataUpdateMode | mode = MetadataUpdateMode::Merge ) |
Merge or replace config and return the complete updated map as JSON.
value == std::nullopt removes the key; any string value (including an empty one) upserts it. MetadataUpdateMode::Replace with an empty vector clears the map. Duplicate keys follow the native builder's last-write-wins behavior. The handle points at the new version after a successful call; existing snapshots retain their prior view. Throws lance::Error on failure.
| void lance::Dataset::update_field_metadata | ( | const std::vector< FieldMetadataUpdate > & | updates | ) |
Apply a batch of per-field metadata updates in one native commit. Duplicate references to the same resolved field follow native last-write-wins behavior. Read the committed field metadata through schema(). Throws lance::Error on failure.
| std::string lance::Dataset::update_metadata_json | ( | const std::vector< std::pair< std::string, std::optional< std::string > > > & | values, |
| MetadataUpdateMode | mode = MetadataUpdateMode::Merge ) |
Merge or replace table metadata and return the complete updated map as a JSON object. A std::nullopt value removes its key; an empty string stores a real empty value. MetadataUpdateMode::Replace with an empty vector clears the map. Mutates this dataset in place; existing snapshots keep their prior view. Throws lance::Error on failure.
| std::string lance::Dataset::update_schema_metadata_json | ( | const std::vector< std::pair< std::string, std::optional< std::string > > > & | values, |
| MetadataUpdateMode | mode = MetadataUpdateMode::Merge ) |
Merge or replace schema metadata and return the complete updated map as a JSON object. Input semantics match update_metadata_json. Read the committed schema metadata through schema(). Throws lance::Error on failure.
| void lance::Dataset::update_tag | ( | const std::string & | name, |
| const Ref & | reference ) const |
Update an existing tag to a native ref. Metadata is preserved natively.
| LanceMergeInsertResult lance::Dataset::upsert | ( | const std::vector< std::string > & | on_columns, |
| ArrowArrayStream * | source ) |
Convenience: classic upsert (when_matched=UpdateAll, when_not_matched=InsertAll).
| std::string lance::Dataset::uri | ( | ) | const |
Fully qualified URI resolved when this dataset was opened. For a namespace-opened dataset this is the describe_table location, not the table ID. The returned copy remains valid after this handle is destroyed. Throws lance::Error on failure.
| void lance::Dataset::validate | ( | ) | const |
Validate native fragments, stable row IDs and indices. Throws lance::Error on failure.
| uint64_t lance::Dataset::version | ( | ) | const |
Version of this dataset snapshot.
| std::vector< VersionDetails > lance::Dataset::version_details | ( | ) | const |
Full version-history details ordered by version id. Each entry contains native nanosecond precision and manifest-summary metadata. Timestamps must fit i64 nanoseconds; versions() retains millisecond precision.
| std::vector< uint64_t > lance::Dataset::version_refs | ( | ) | const |
Lightweight attached-version refs ordered by version id.
| std::vector< VersionInfo > lance::Dataset::versions | ( | ) | const |
Snapshot the dataset's version history, ordered by version id. Throws lance::Error on failure.
|
static |
Write an Arrow record batch stream to a Lance dataset and return the open dataset at the committed version.
The stream must be self-describing; its own schema is used. Treat the stream as consumed once this call returns or throws — do not reuse it. Throws lance::Error on failure (including if stream is null).
|
static |
Same as the four-argument write but tunes the output via params. Pass a default-constructed WriteParams{} to inherit upstream defaults.
This overload preserves the legacy lance-c 20-version / 14-day auto-cleanup policy. Use write_with_options for native WriteParams::default() semantics.
|
static |
Write into a namespace-managed table. CREATE uses native declare_table; APPEND/OVERWRITE use native describe/commit-handler behavior. A non-empty branch selects native write_into_namespace_on_branch. Native write defaults apply (the legacy 20/14 cleanup policy is not added).
|
static |
Write an Arrow stream without committing, returning the owned native transaction for later publication with Dataset::commit.
The stream is consumed on success and on every C-side error path. The C++ guard releases it if schema extraction or local conversion throws before the call. session is borrowed only for this call; native values retain shared ownership of its caches.
|
static |
Write uncommitted data with a native dynamic accessor for data-file writes performed by this call.
The returned transaction carries transaction metadata only and does not retain the accessor; pass it again to commit_with_accessor when commit I/O needs dynamic storage options. All other stream and transaction semantics match write_uncommitted.
|
static |
Stage an Arrow stream through a foreign commit lock and optional dynamic storage accessor.
Staging uses the accessor and session exactly like write_uncommitted. The lock is retained for this call. Keep its handle alive and pass it to the matching commit method when publishing the returned transaction. NULL pointers keep native defaults. The stream is consumed on every return path.
|
static |
Stage an Arrow stream with an owned native-backed options handle.
The returned transaction owns uncommitted data-file metadata and does not retain the options handle. Publication naming remains controlled by Dataset::commit / Transaction commit options. The stream is consumed on every return path. Throws lance::Error on failure; a failed stage does not publish a version.
|
static |
Write with a retained native dynamic storage-options accessor. This keeps the legacy 20/14 auto-cleanup policy. The returned dataset retains the accessor and provider for later I/O.
|
static |
Write with an owned native-backed options handle.
The handle supplies native write defaults plus the session, storage accessor, commit lock, base placement, blob policy, file-writer options and progress callbacks. The handle is borrowed only for this call. The stream is consumed on every return path. Throws lance::Error on failure.
|
static |
Write using native WriteParams::default() semantics.
A default-constructed WriteOptions sets auto_cleanup = / std::nullopt (native None) and skip_auto_cleanup = false. auto_cleanup is persisted only by CREATE; APPEND and OVERWRITE leave an existing dataset's policy unchanged. skip_auto_cleanup affects only the current commit. Throws lance::Error on failure.
|
static |
Write with native WriteParams::default() semantics and a retained native dynamic storage-options accessor.
|
static |
Write using native defaults through a foreign commit lock and optional dynamic storage accessor.
The accessor and lock owners are retained by the committed dataset. NULL pointers keep native defaults. The stream is consumed on every return path. Throws lance::Error on failure.
|
static |
Write with explicit legacy WriteParams and a retained native dynamic storage-options accessor.
|
friend |
Definition at line 5222 of file declarations.hpp.