MCPcopy Create free account
hub / github.com/TileDB-Inc/TileDB / validate_tiles_read

Method validate_tiles_read

test/src/test-cppapi-aggregates.cc:1173–1230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1171
1172template <class T>
1173void CppAggregatesFx<T>::validate_tiles_read(Query& query, bool is_count) {
1174 // Validate the number of tiles read.
1175 auto stats = query.stats();
1176
1177 uint64_t num_tiles_read = get_stat("num_tiles_read", stats);
1178 uint64_t expected_num_tiles_read;
1179 if (dense_) {
1180 // Dense has 5 tiles. If we request data or have a query condition, we'll
1181 // read all of them.
1182 if (request_data_ || set_qc_) {
1183 expected_num_tiles_read = 5;
1184 } else if (set_ranges_) {
1185 // If we request range, we split all tiles, we'll have to read all instead
1186 // of using fragment metadata.
1187 expected_num_tiles_read = is_count || use_dim_ ? 0 : 5;
1188 } else {
1189 // One space tile has two result tiles, we'll have to read them instead of
1190 // using fragment metadata.
1191 expected_num_tiles_read = is_count || use_dim_ ? 0 : 2;
1192 }
1193 } else {
1194 if (request_data_) {
1195 // Sparse has 5 tiles * 3 (2 dims/1 attr). One of them will be filtered
1196 // out when we set ranges.
1197 if (set_ranges_) {
1198 // If we set ranges, we filter out one of the 5 tiles.
1199 expected_num_tiles_read = 12;
1200 } else {
1201 // Everything is read.
1202 expected_num_tiles_read = 15;
1203 }
1204 } else {
1205 if (set_ranges_) {
1206 // For count, we only read dimension tiles, one of which is filtered so
1207 // we read 2 dims * 4 tiles. For the attribute, we can process 2 tiles
1208 // with duplicates and 1 without using the fragment metadata.
1209 if (allow_dups_) {
1210 expected_num_tiles_read = use_dim_ || is_count ? 8 : 10;
1211 } else {
1212 expected_num_tiles_read = use_dim_ || is_count ? 8 : 11;
1213 }
1214 } else {
1215 if (allow_dups_) {
1216 // No ranges, array with duplicates can do it all with fragment
1217 // metadata only.
1218 expected_num_tiles_read = 0;
1219 } else {
1220 // Arrays without duplicates need to run deduplication, so we read the
1221 // dimension tiles (2 dims * 5 tiles). Only one tile for the attribute
1222 // can be processed with fragment metadata only.
1223 expected_num_tiles_read = use_dim_ || is_count ? 10 : 14;
1224 }
1225 }
1226 }
1227 }
1228
1229 CHECK(num_tiles_read == expected_num_tiles_read);
1230}

Callers 1

Calls 2

get_statFunction · 0.85
statsMethod · 0.45

Tested by

no test coverage detected