| 1138 | } |
| 1139 | |
| 1140 | bool SubarrayPartitioner::must_split(Subarray* partition) { |
| 1141 | for (const auto& b : budget_) { |
| 1142 | /* |
| 1143 | * Compute max memory size and, if needed, estimated result size |
| 1144 | */ |
| 1145 | auto name = b.first; |
| 1146 | auto mem_size{ |
| 1147 | partition->get_max_memory_size(b.first.c_str(), config_, compute_tp_)}; |
| 1148 | auto est_size{ |
| 1149 | skip_split_on_est_size_ ? |
| 1150 | // Skip the estimate and use a default object that's all zeros. |
| 1151 | FieldDataSize{} : |
| 1152 | // Perform the estimate |
| 1153 | partition->get_est_result_size( |
| 1154 | b.first.c_str(), config_, compute_tp_)}; |
| 1155 | |
| 1156 | // If we try to split a unary range because of memory budgets, throw an |
| 1157 | // error. This can happen when the memory budget cannot fit even one tile. |
| 1158 | // It will cause the reader to process the query cell by cell, which will |
| 1159 | // make it very slow. |
| 1160 | if (!skip_unary_partitioning_budget_check_ && |
| 1161 | (mem_size.fixed_ > memory_budget_ || |
| 1162 | mem_size.variable_ > memory_budget_var_ || |
| 1163 | mem_size.validity_ > memory_budget_validity_)) { |
| 1164 | if (partition->is_unary()) { |
| 1165 | throw SubarrayPartitionerException( |
| 1166 | "Trying to partition a unary range because of memory budget, this " |
| 1167 | "will cause the query to run very slow. Increase " |
| 1168 | "`sm.memory_budget` and `sm.memory_budget_var` through the " |
| 1169 | "configuration settings to avoid this issue. To override and run " |
| 1170 | "the query with the same budget, set " |
| 1171 | "`sm.skip_unary_partitioning_budget_check` to `true`."); |
| 1172 | } |
| 1173 | } |
| 1174 | |
| 1175 | // Check for budget overflow |
| 1176 | if ((!skip_split_on_est_size_ && |
| 1177 | (est_size.fixed_ > b.second.size_fixed_ || |
| 1178 | est_size.variable_ > b.second.size_var_ || |
| 1179 | est_size.validity_ > b.second.size_validity_)) || |
| 1180 | mem_size.fixed_ > memory_budget_ || |
| 1181 | mem_size.variable_ > memory_budget_var_ || |
| 1182 | mem_size.validity_ > memory_budget_validity_) { |
| 1183 | return true; |
| 1184 | } |
| 1185 | } |
| 1186 | return false; |
| 1187 | } |
| 1188 | |
| 1189 | Status SubarrayPartitioner::next_from_multi_range(bool* unsplittable) { |
| 1190 | // A new multi-range subarray may need to be put in the list and split |
no test coverage detected