use tracing::{debug, warn};
use crate::bridge::envelope::{ErrorCode, Response};
use crate::data::executor::core_loop::CoreLoop;
use crate::data::executor::task::ExecutionTask;
use crate::engine::graph::pattern::ast::MatchQuery;
impl CoreLoop {
pub(in crate::data::executor) fn execute_graph_match(
&self,
task: &ExecutionTask,
query_bytes: &[u8],
) -> Response {
debug!(core = self.core_id, "graph match execution");
let query: MatchQuery = match rmp_serde::from_slice(query_bytes) {
Ok(q) => q,
Err(e) => {
warn!(core = self.core_id, error = %e, "failed to deserialize MatchQuery");
return self.response_error(
task,
ErrorCode::Internal {
detail: format!("invalid match query: {e}"),
},
);
}
};
match crate::engine::graph::pattern::executor::execute(&query, &self.csr, &self.edge_store)
{
Ok(rows) => match crate::engine::graph::pattern::executor::rows_to_json(&rows) {
Ok(payload) => self.response_with_payload(task, payload),
Err(e) => self.response_error(task, ErrorCode::from(e)),
},
Err(e) => self.response_error(task, ErrorCode::from(e)),
}
}
}