MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / dispatch_array_project

Method dispatch_array_project

nodedb/src/data/executor/dispatch/array/read.rs:230–298  ·  view source on GitHub ↗
(
        &mut self,
        task: &ExecutionTask,
        array_id: &ArrayId,
        attr_indices: &[u32],
    )

Source from the content-addressed store, hash-verified

228 }
229
230 pub(in crate::data::executor) fn dispatch_array_project(
231 &mut self,
232 task: &ExecutionTask,
233 array_id: &ArrayId,
234 attr_indices: &[u32],
235 ) -> Response {
236 if let Err(resp) = self.ensure_array_open(task, array_id) {
237 return resp;
238 }
239 let schema = match self.array_engine.store(array_id) {
240 Ok(store) => store.schema().clone(),
241 Err(e) => {
242 return self.response_error(
243 task,
244 ErrorCode::Unsupported {
245 detail: format!("array '{}' not open: {e}", array_id.name),
246 },
247 );
248 }
249 };
250
251 let tiles = match self
252 .array_engine
253 .scan_tiles(array_id, &MbrQueryPredicate::default())
254 {
255 Ok(t) => t,
256 Err(e) => {
257 return self.response_error(
258 task,
259 ErrorCode::Internal {
260 detail: format!("array project scan: {e}"),
261 },
262 );
263 }
264 };
265
266 let proj = Projection::new(attr_indices.iter().map(|&i| i as usize).collect());
267
268 let mut rows: Vec<Value> = Vec::new();
269 for tile in tiles {
270 let sparse: SparseTile = match tile {
271 TilePayload::Sparse(s) => s,
272 TilePayload::Dense(_) => {
273 return self.response_error(
274 task,
275 ErrorCode::Unsupported {
276 detail: "dense tile payload in project".to_string(),
277 },
278 );
279 }
280 };
281 let projected = match project_sparse(&sparse, &proj) {
282 Ok(t) => t,
283 Err(e) => {
284 return self.response_error(
285 task,
286 ErrorCode::Internal {
287 detail: format!("array project: {e}"),

Callers 1

dispatch_arrayMethod · 0.80

Calls 14

project_sparseFunction · 0.85
ArrayCellClass · 0.85
encode_value_rowsFunction · 0.85
ensure_array_openMethod · 0.80
response_errorMethod · 0.80
collectMethod · 0.80
to_stringMethod · 0.80
storeMethod · 0.45
cloneMethod · 0.45
schemaMethod · 0.45
scan_tilesMethod · 0.45

Tested by

no test coverage detected