From 9fa3b9da23e8d4f5969a4052de4bb01d92b5c37b Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Mon, 22 May 2023 18:20:39 +0200 Subject: [PATCH] feat(cognitarium): handle engine limit query node --- contracts/okp4-cognitarium/src/querier/engine.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/contracts/okp4-cognitarium/src/querier/engine.rs b/contracts/okp4-cognitarium/src/querier/engine.rs index 1da587e4..9c1b827e 100644 --- a/contracts/okp4-cognitarium/src/querier/engine.rs +++ b/contracts/okp4-cognitarium/src/querier/engine.rs @@ -35,7 +35,12 @@ impl<'a> QueryEngine<'a> { } QueryNode::ForLoopJoin { left, right } => Box::new(move |_| Box::new(iter::empty())), QueryNode::Skip { child, first } => Box::new(move |_| Box::new(iter::empty())), - QueryNode::Limit { child, first } => Box::new(move |_| Box::new(iter::empty())), + QueryNode::Limit { child, first } => { + let upstream = self.eval_node(child); + Box::new(move |vars| -> ResolvedVariablesIterator { + Box::new(upstream(vars).take(first)) + }) + } } } }