| 1231 | |
| 1232 | template <class T> |
| 1233 | void CppAggregatesFx<T>::validate_tiles_read_null_count(Query& query) { |
| 1234 | // Validate the number of tiles read. |
| 1235 | auto stats = query.stats(); |
| 1236 | |
| 1237 | uint64_t num_tiles_alloced = get_stat("tiles_allocated", stats); |
| 1238 | uint64_t num_tiles_unfiltered = get_stat("tiles_unfiltered", stats); |
| 1239 | uint64_t expected_num_tiles; |
| 1240 | if (dense_) { |
| 1241 | // Dense has 5 tiles. If we request data or have a query condition, we'll |
| 1242 | // read all of them. |
| 1243 | if (request_data_ || set_qc_) { |
| 1244 | expected_num_tiles = 10; |
| 1245 | } else if (set_ranges_) { |
| 1246 | // If we request range, we split all tiles, we'll have to read all, but |
| 1247 | // only nullable tiles. |
| 1248 | expected_num_tiles = 5; |
| 1249 | } else { |
| 1250 | // One space tile has two result tiles, we'll have to read them. |
| 1251 | expected_num_tiles = 2; |
| 1252 | } |
| 1253 | } else { |
| 1254 | // Sparse has 5 tiles * 4 (2 dims/1 attr (fixed tile + nullable tile)). One |
| 1255 | // of them will be filtered out when we set ranges. |
| 1256 | if (request_data_) { |
| 1257 | if (set_ranges_) { |
| 1258 | // If we set ranges, we filter out one of the 5 tiles. |
| 1259 | expected_num_tiles = 16; |
| 1260 | } else { |
| 1261 | // Everything is read. |
| 1262 | expected_num_tiles = 20; |
| 1263 | } |
| 1264 | } else { |
| 1265 | if (set_ranges_) { |
| 1266 | // We read dimension tiles to filter ranges, one of which is filtered so |
| 1267 | // we read 2 dims * 4 tiles. For the attribute, we can process 2 tiles |
| 1268 | // with duplicates and 1 without using the fragment metadata. Note that |
| 1269 | // we only add one per space tile for the attribute because we only read |
| 1270 | // the validity tile. |
| 1271 | if (allow_dups_) { |
| 1272 | expected_num_tiles = 10; |
| 1273 | } else { |
| 1274 | expected_num_tiles = 11; |
| 1275 | } |
| 1276 | } else { |
| 1277 | if (allow_dups_) { |
| 1278 | // No ranges, array with duplicates can do it all with fragment |
| 1279 | // metadata only. |
| 1280 | expected_num_tiles = 0; |
| 1281 | } else { |
| 1282 | // Arrays without duplicates need to run deduplication, so we read the |
| 1283 | // dimension tiles (2 dims * 5 tiles). Only one tile for the attribute |
| 1284 | // can be processed with fragment metadata only. Note that we only add |
| 1285 | // one per space tile for the attribute because we only read the |
| 1286 | // validity tile. |
| 1287 | expected_num_tiles = 14; |
| 1288 | } |
| 1289 | } |
| 1290 | } |