Skip to content

Commit 659bff8

Browse files
refactor(query-engine): derive key reads from plan spec
1 parent 3539309 commit 659bff8

1 file changed

Lines changed: 8 additions & 14 deletions

File tree

‎asap-query-engine/src/engines/query_plan.rs‎

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -170,26 +170,20 @@ impl QueryPlan {
170170
StoreReadStrategy::for_window(&estimate_spec.values.window),
171171
);
172172
let values = Self::push_prepare_buckets(&mut nodes, values_read);
173-
let keys = context
174-
.base
175-
.store_plan
176-
.keys_query
177-
.as_ref()
178-
.map(|query| match &estimate_spec.keys {
179-
KeyInputSpec::Separate { window, .. } => {
173+
let keys = match &estimate_spec.keys {
174+
KeyInputSpec::FromValues => None,
175+
KeyInputSpec::Separate { window, .. } => {
176+
context.base.store_plan.keys_query.as_ref().map(|query| {
180177
let read = Self::push_read(
181178
&mut nodes,
182179
query,
183180
StoreReadRole::Keys,
184181
StoreReadStrategy::for_window(window),
185182
);
186-
Ok(Self::push_prepare_buckets(&mut nodes, read))
187-
}
188-
KeyInputSpec::FromValues => {
189-
Err("Query plan has a keys read without a keys specification".to_string())
190-
}
191-
})
192-
.transpose()?;
183+
Self::push_prepare_buckets(&mut nodes, read)
184+
})
185+
}
186+
};
193187
let resolved = Self::push(&mut nodes, QueryPlanNode::ResolveKeys { values, keys });
194188
let mut root = Self::push(
195189
&mut nodes,

0 commit comments

Comments
 (0)