| 2635 | } |
| 2636 | |
| 2637 | void executeTrivialBlockIO(BlockIO & streams, ContextPtr context, bool with_interactive_cancel) |
| 2638 | { |
| 2639 | try |
| 2640 | { |
| 2641 | if (!streams.pipeline.initialized()) |
| 2642 | return; |
| 2643 | |
| 2644 | if (!streams.pipeline.completed()) |
| 2645 | throw Exception(ErrorCodes::LOGICAL_ERROR, "Query pipeline requires output, but no output buffer provided, it's a bug"); |
| 2646 | |
| 2647 | streams.pipeline.setProgressCallback(context->getProgressCallback()); |
| 2648 | |
| 2649 | CompletedPipelineExecutor executor(streams.pipeline); |
| 2650 | |
| 2651 | if (auto callback = context->getInteractiveCancelCallback(); callback && with_interactive_cancel) |
| 2652 | { |
| 2653 | auto interactive_delay = context->getSettingsRef()[Setting::interactive_delay]; |
| 2654 | executor.setCancelCallback(std::move(callback), interactive_delay / 1000); |
| 2655 | } |
| 2656 | |
| 2657 | executor.execute(); |
| 2658 | } |
| 2659 | catch (...) |
| 2660 | { |
| 2661 | streams.onException(); |
| 2662 | throw; |
| 2663 | } |
| 2664 | |
| 2665 | streams.onFinish(); |
| 2666 | } |
| 2667 | |
| 2668 | } |
no test coverage detected