From e53f6c62f3f57b24def61a4104d57f95f3560777 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 472e2e82a26..0719f3fd5d9 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" @@ -114,6 +115,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) { @@ -150,6 +154,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);