diff --git a/core/src/dbs/iterator.rs b/core/src/dbs/iterator.rs
index f4862574..ca1d3896 100644
--- a/core/src/dbs/iterator.rs
+++ b/core/src/dbs/iterator.rs
@@ -19,18 +19,19 @@ use crate::sql::thing::Thing;
use crate::sql::value::Value;
use async_recursion::async_recursion;
use std::mem;
+use std::sync::Arc;
#[derive(Clone)]
pub(crate) enum Iterable {
Value(Value),
- Table(Table),
+ Table(Arc
),
Thing(Thing),
Range(Range),
Edges(Edges),
Defer(Thing),
Mergeable(Thing, Value),
Relatable(Thing, Thing, Thing),
- Index(Table, IteratorRef),
+ Index(Arc, IteratorRef),
}
pub(crate) struct Processed {
@@ -117,7 +118,7 @@ impl Iterator {
}
_ => {
// Ingest the table for scanning
- self.ingest(Iterable::Table(v))
+ self.ingest(Iterable::Table(Arc::new(v)))
}
},
// There is no data clause so create a record id
@@ -128,7 +129,7 @@ impl Iterator {
}
_ => {
// Ingest the table for scanning
- self.ingest(Iterable::Table(v))
+ self.ingest(Iterable::Table(Arc::new(v)))
}
},
},
diff --git a/core/src/dbs/processor.rs b/core/src/dbs/processor.rs
index 7292e205..6d8dea7a 100644
--- a/core/src/dbs/processor.rs
+++ b/core/src/dbs/processor.rs
@@ -127,10 +127,10 @@ impl<'a> Processor<'a> {
// Avoiding search in the hashmap of the query planner for each doc
let mut ctx = Context::new(ctx);
ctx.set_query_executor(exe.clone());
- return self.process_table(&ctx, opt, txn, stm, v).await;
+ return self.process_table(&ctx, opt, txn, stm, v.as_ref()).await;
}
}
- self.process_table(ctx, opt, txn, stm, v).await?
+ self.process_table(ctx, opt, txn, stm, v.as_ref()).await?
}
Iterable::Range(v) => self.process_range(ctx, opt, txn, stm, v).await?,
Iterable::Edges(e) => self.process_edge(ctx, opt, txn, stm, e).await?,
@@ -141,10 +141,10 @@ impl<'a> Processor<'a> {
// Avoiding search in the hashmap of the query planner for each doc
let mut ctx = Context::new(ctx);
ctx.set_query_executor(exe.clone());
- return self.process_index(&ctx, opt, txn, stm, t, ir).await;
+ return self.process_index(&ctx, opt, txn, stm, t.as_ref(), ir).await;
}
}
- self.process_index(ctx, opt, txn, stm, t, ir).await?
+ self.process_index(ctx, opt, txn, stm, t.as_ref(), ir).await?
}
Iterable::Mergeable(v, o) => {
self.process_mergeable(ctx, opt, txn, stm, v, o).await?
@@ -302,13 +302,13 @@ impl<'a> Processor<'a> {
opt: &Options,
txn: &Transaction,
stm: &Statement<'_>,
- v: Table,
+ v: &Table,
) -> Result<(), Error> {
// Check that the table exists
- txn.lock().await.check_ns_db_tb(opt.ns(), opt.db(), &v, opt.strict).await?;
+ txn.lock().await.check_ns_db_tb(opt.ns(), opt.db(), v, opt.strict).await?;
// Prepare the start and end keys
- let beg = thing::prefix(opt.ns(), opt.db(), &v);
- let end = thing::suffix(opt.ns(), opt.db(), &v);
+ let beg = thing::prefix(opt.ns(), opt.db(), v);
+ let end = thing::suffix(opt.ns(), opt.db(), v);
// Loop until no more keys
let mut next_page = Some(ScanPage::from(beg..end));
while let Some(page) = next_page {
@@ -556,7 +556,7 @@ impl<'a> Processor<'a> {
opt: &Options,
txn: &Transaction,
stm: &Statement<'_>,
- table: Table,
+ table: &Table,
ir: IteratorRef,
) -> Result<(), Error> {
// Check that the table exists
diff --git a/core/src/idx/planner/executor.rs b/core/src/idx/planner/executor.rs
index 1bc980c0..4de9ec1b 100644
--- a/core/src/idx/planner/executor.rs
+++ b/core/src/idx/planner/executor.rs
@@ -266,20 +266,7 @@ impl QueryExecutor {
) -> Result