| 204 | } |
| 205 | |
| 206 | bool PhysicalOperator::getNextTuple(ExecutionContext* context) { |
| 207 | if (context->clientContext->interrupted()) { |
| 208 | throw InterruptException{}; |
| 209 | } |
| 210 | #ifdef __SINGLE_THREADED__ |
| 211 | // In single-threaded mode, the timeout cannot be checked in the main thread |
| 212 | // because the main thread is blocked by the task execution. Instead, we |
| 213 | // check the timeout in the processor. The timeout handling may still be |
| 214 | // delayed, but it is better than checking it at the end of each task. |
| 215 | // This is the best we can do now because SIGALRM is not cross-platform. |
| 216 | if (context->clientContext->hasTimeout()) { |
| 217 | if (context->clientContext->getTimeoutRemainingInMS() == 0) { |
| 218 | throw InterruptException{}; |
| 219 | } |
| 220 | } |
| 221 | #endif |
| 222 | metrics->executionTime.start(); |
| 223 | auto result = getNextTuplesInternal(context); |
| 224 | ProgressBar::Get(*context->clientContext) |
| 225 | ->updateProgress(context->queryID, getProgress(context)); |
| 226 | metrics->executionTime.stop(); |
| 227 | return result; |
| 228 | } |
| 229 | |
| 230 | void PhysicalOperator::finalize(ExecutionContext* context) { |
| 231 | if (!isSource()) { |
no test coverage detected