From c0b194cb2c30a6ea1ed3bf95f6b1f9152fec513c Mon Sep 17 00:00:00 2001 From: andyfeng Date: Mon, 9 Dec 2024 14:52:13 +0800 Subject: [PATCH] Add inturrupt to path writer (#4609) * Add inturrupt to path writer * Run clang-format --------- Co-authored-by: CI Bot --- src/function/gds/output_writer.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/function/gds/output_writer.cpp b/src/function/gds/output_writer.cpp index 21abb4c7075..7937c0579b4 100644 --- a/src/function/gds/output_writer.cpp +++ b/src/function/gds/output_writer.cpp @@ -1,5 +1,6 @@ #include "function/gds/output_writer.h" +#include "common/exception/interrupt.h" #include "function/gds/gds_frontier.h" #include "main/client_context.h" @@ -108,6 +109,9 @@ void PathsOutputWriter::write(processor::FactorizedTable& fTable, nodeID_t dstNo if (!info.hasNodeMask() && info.semantic == common::PathSemantic::WALK) { // Fast path when there is no node predicate or semantic check while (!curPath.empty()) { + if (context->interrupted()) { + throw InterruptException{}; + } auto top = curPath[curPath.size() - 1]; auto topNodeID = top->getNodeID(); if (top->getIter() == 1) { @@ -144,6 +148,9 @@ void PathsOutputWriter::write(processor::FactorizedTable& fTable, nodeID_t dstNo return; } while (!curPath.empty()) { + if (context->interrupted()) { + throw InterruptException{}; + } if (getTop(curPath)->getIter() == 1) { writePath(curPath); fTable.append(vectors);