Skip to content

Commit

Permalink
code-review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkerl committed Jan 9, 2025
1 parent 5643118 commit f0d776b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
4 changes: 3 additions & 1 deletion tiledb/sm/array_schema/current_domain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,9 @@ std::string CurrentDomain::as_string() const {
} else {
// As of 2025-01-09 there is no other such type. When/if we do make such a
// type, we'd need to configure it to return a description of itself.
return "CurrentDomain of non-NDRectangle type";
throw std::runtime_error(
"CurrentDomain::as_string of non-NDRectangle type is not implemented";
);
}
}

Expand Down
22 changes: 13 additions & 9 deletions tiledb/sm/query/query.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
* This file implements class Query.
*/

#include "tiledb/sm/query/query.h"
#include "tiledb/common/common.h"
#include "tiledb/common/heap_memory.h"
#include "tiledb/common/logger.h"
Expand All @@ -46,6 +45,7 @@
#include "tiledb/sm/query/deletes_and_updates/deletes_and_updates.h"
#include "tiledb/sm/query/dimension_label/array_dimension_label_queries.h"
#include "tiledb/sm/query/legacy/reader.h"
#include "tiledb/sm/query/query.h"
#include "tiledb/sm/query/query_condition.h"
#include "tiledb/sm/query/readers/dense_reader.h"
#include "tiledb/sm/query/readers/ordered_dim_label_reader.h"
Expand All @@ -59,7 +59,6 @@
#include "tiledb/sm/tile/writer_tile_tuple.h"

#include <cassert>
#include <format>
#include <iostream>
#include <sstream>

Expand Down Expand Up @@ -860,13 +859,18 @@ Status Query::process() {
// Make sure all ranges are contained in the current domain.
for (auto& range : subarray_.ranges_for_dim(d)) {
if (!cd->includes(d, range)) {
throw QueryException(std::format(
"A range {} on dimension '{}' was set outside of the current "
"domain {}.",
range_str(
range, array_schema_->domain().dimension_ptr(d)->type()),
array_schema_->domain().dimension_ptr(d)->name(),
cd->as_string()));
// No std::format:
// https://github.com/TileDB-Inc/TileDB/pull/5421#discussion_r1909405876
std::stringstream ss;
ss << "A range ";
ss << range_str(
range, array_schema_->domain().dimension_ptr(d)->type());
ss << " on dimension '";
ss << array_schema_->domain().dimension_ptr(d)->name();
ss << "' was set outside of the current domain ";
ss << cd->as_string();
ss << ".";
throw QueryException(ss.str());
}
}
} else if (!all_ned_contained_in_current_domain) {
Expand Down

0 comments on commit f0d776b

Please sign in to comment.