| 1069 | } |
| 1070 | |
| 1071 | Status QueryState::StartSpilling(RuntimeState* runtime_state, MemTracker* mem_tracker) { |
| 1072 | // Return an error message with the root cause of why spilling is disabled. |
| 1073 | if (query_options().scratch_limit == 0) { |
| 1074 | return mem_tracker->MemLimitExceeded( |
| 1075 | runtime_state, "Could not free memory by spilling to disk: scratch_limit is 0"); |
| 1076 | } else if (query_ctx_.disable_spilling) { |
| 1077 | return mem_tracker->MemLimitExceeded(runtime_state, |
| 1078 | "Could not free memory by spilling to disk: spilling was disabled by planner. " |
| 1079 | "Re-enable spilling by setting the query option DISABLE_UNSAFE_SPILLS=false"); |
| 1080 | } |
| 1081 | // 'file_group_' must be non-NULL for spilling to be enabled. |
| 1082 | DCHECK(file_group_ != nullptr); |
| 1083 | if (query_spilled_.CompareAndSwap(0, 1)) { |
| 1084 | ImpaladMetrics::NUM_QUERIES_SPILLED->Increment(1); |
| 1085 | } |
| 1086 | return Status::OK(); |
| 1087 | } |
| 1088 | } |
no test coverage detected