Operation: add method index() to retrieve used index, if any

This commit is contained in:
Jussi Saurio
2025-04-15 11:18:09 +03:00
parent e299a0e77e
commit 72dac59813

View File

@@ -281,6 +281,17 @@ pub enum Operation {
},
}
impl Operation {
pub fn index(&self) -> Option<&Arc<Index>> {
match self {
Operation::Scan { index, .. } => index.as_ref(),
Operation::Search(Search::RowidEq { .. }) => None,
Operation::Search(Search::Seek { index, .. }) => index.as_ref(),
Operation::Subquery { .. } => None,
}
}
}
impl TableReference {
/// Returns the btree table for this table reference, if it is a BTreeTable.
pub fn btree(&self) -> Option<Rc<BTreeTable>> {