Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion rust/lance/src/dataset/mem_wal/index/pk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use datafusion::common::ScalarValue;
use lance_core::{Error, Result};

use super::pk_key::{encode_pk_batch, encode_pk_tuple};
use super::{BTreeMemIndex, IndexStore, PrimaryKeyIndex, RowPosition};
use super::{BTreeMemIndex, IndexStore, MemIndex, PrimaryKeyIndex, RowPosition};

/// The column a composite key index is keyed on: the order-preserving encoded
/// tuple, stored as `Binary` so a [`BTreeMemIndex`] indexes it directly.
Expand Down Expand Up @@ -182,6 +182,16 @@ impl IndexStore {
self.pk_index.is_some()
}

/// The primary-key index's key columns, in the order its lookups take
/// values.
pub fn pk_columns(&self) -> Option<&[String]> {
match self.pk_index.as_ref()? {
PkIndex::Shared { entry, .. } => self.indexes.get(entry).map(|index| index.columns()),
PkIndex::Owned(OwnedPk::Single(index)) => Some(index.columns()),
PkIndex::Owned(OwnedPk::Composite { columns, .. }) => Some(columns),
}
}

/// Sorted `(key, row id)` batches for training the generation's on-disk
/// key index: the typed key for one column, the encoded tuple for several.
/// Positions are the flushed file's row ids.
Expand Down
Loading
Loading