| 1698 | } |
| 1699 | |
| 1700 | StreamLocalLimits getLimitsForStorage(const Settings & settings, const SelectQueryOptions & options) |
| 1701 | { |
| 1702 | StreamLocalLimits limits; |
| 1703 | limits.mode = LimitsMode::LIMITS_TOTAL; |
| 1704 | limits.size_limits = SizeLimits(settings.max_rows_to_read, settings.max_bytes_to_read, settings.read_overflow_mode); |
| 1705 | limits.speed_limits.max_execution_time = settings.max_execution_time; |
| 1706 | limits.timeout_overflow_mode = settings.timeout_overflow_mode; |
| 1707 | |
| 1708 | /** Quota and minimal speed restrictions are checked on the initiating server of the request, and not on remote servers, |
| 1709 | * because the initiating server has a summary of the execution of the request on all servers. |
| 1710 | * |
| 1711 | * But limits on data size to read and maximum execution time are reasonable to check both on initiator and |
| 1712 | * additionally on each remote server, because these limits are checked per block of data processed, |
| 1713 | * and remote servers may process way more blocks of data than are received by initiator. |
| 1714 | * |
| 1715 | * The limits to throttle maximum execution speed is also checked on all servers. |
| 1716 | */ |
| 1717 | if (options.to_stage == QueryProcessingStage::Complete) |
| 1718 | { |
| 1719 | limits.speed_limits.min_execution_rps = settings.min_execution_speed; |
| 1720 | limits.speed_limits.min_execution_bps = settings.min_execution_speed_bytes; |
| 1721 | } |
| 1722 | |
| 1723 | limits.speed_limits.max_execution_rps = settings.max_execution_speed; |
| 1724 | limits.speed_limits.max_execution_bps = settings.max_execution_speed_bytes; |
| 1725 | limits.speed_limits.timeout_before_checking_execution_speed = settings.timeout_before_checking_execution_speed; |
| 1726 | |
| 1727 | return limits; |
| 1728 | } |
| 1729 | |
| 1730 | static void executeMergeAggregatedImpl( |
| 1731 | QueryPlan & query_plan, |
no test coverage detected