fix few places which needs to be hooked into new types

This commit is contained in:
Nikita Sivukhin
2025-10-27 18:17:49 +04:00
parent 8dd2644c07
commit 35b96ae8d8
4 changed files with 42 additions and 1 deletions

View File

@@ -865,7 +865,7 @@ impl Limbo {
) -> usize {
let indent_count = match prev_insn {
"Rewind" | "Last" | "SorterSort" | "SeekGE" | "SeekGT" | "SeekLE"
| "SeekLT" | "BeginSubrtn" => indent_count + 1,
| "SeekLT" | "BeginSubrtn" | "IndexMethodQuery" => indent_count + 1,
_ => indent_count,
};

View File

@@ -119,6 +119,15 @@ impl Display for SelectPlan {
)?;
}
},
Operation::IndexMethodQuery(query) => {
let index_method = query.index.index_method.as_ref().unwrap();
writeln!(
f,
"{}QUERY INDEX METHOD {}",
indent,
index_method.definition().method_name
)?;
}
}
}
Ok(())
@@ -161,6 +170,15 @@ impl Display for DeletePlan {
)?;
}
},
Operation::IndexMethodQuery(query) => {
let module = query.index.index_method.as_ref().unwrap();
writeln!(
f,
"{}QUERY MODULE {}",
indent,
module.definition().method_name
)?;
}
}
}
Ok(())
@@ -215,6 +233,15 @@ impl fmt::Display for UpdatePlan {
)?;
}
},
Operation::IndexMethodQuery(query) => {
let module = query.index.index_method.as_ref().unwrap();
writeln!(
f,
"{}QUERY MODULE {}",
indent,
module.definition().method_name
)?;
}
}
}
if !self.order_by.is_empty() {

View File

@@ -390,6 +390,10 @@ pub fn emit_from_clause_subqueries(
)
}
},
Operation::IndexMethodQuery(query) => {
let index_method = query.index.index_method.as_ref().unwrap();
format!("QUERY INDEX METHOD {}", index_method.definition().method_name)
}
}
);

View File

@@ -5,6 +5,7 @@ use turso_parser::ast::SortOrder;
use crate::error::LimboError;
use crate::ext::{ExtValue, ExtValueType};
use crate::index_method::IndexMethodCursor;
use crate::numeric::format_float;
use crate::pseudo::PseudoCursor;
use crate::schema::Index;
@@ -2271,6 +2272,7 @@ impl Record {
pub enum Cursor {
BTree(Box<dyn CursorTrait>),
IndexMethod(Box<dyn IndexMethodCursor>),
Pseudo(PseudoCursor),
Sorter(Sorter),
Virtual(VirtualTableCursor),
@@ -2281,6 +2283,7 @@ impl Debug for Cursor {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::BTree(..) => f.debug_tuple("BTree").finish(),
Self::IndexMethod(..) => f.debug_tuple("IndexMethod").finish(),
Self::Pseudo(..) => f.debug_tuple("Pseudo").finish(),
Self::Sorter(..) => f.debug_tuple("Sorter").finish(),
Self::Virtual(..) => f.debug_tuple("Virtual").finish(),
@@ -2344,6 +2347,13 @@ impl Cursor {
_ => panic!("Cursor is not a materialized view cursor"),
}
}
pub fn as_index_method_mut(&mut self) -> &mut dyn IndexMethodCursor {
match self {
Self::IndexMethod(cursor) => cursor.as_mut(),
_ => panic!("Cursor is not an IndexMethod cursor"),
}
}
}
#[derive(Debug)]