Skip to content

Commit

Permalink
merge adaptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan24680 committed Oct 11, 2024
1 parent 2ddae9d commit a9eb289
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/engine/SpatialJoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ std::string SpatialJoin::betweenQuotes(std::string extractFrom) const {
}

std::optional<GeoPoint> SpatialJoin::getPoint(const IdTable* restable,
size_t row, ColumnIndex col) {
size_t row, ColumnIndex col) const {
auto id = restable->at(row, col);
return id.getDatatype() == Datatype::GeoPoint
? std::optional{id.getGeoPoint()}
Expand Down
4 changes: 1 addition & 3 deletions src/engine/SpatialJoin.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ class SpatialJoin : public Operation {
return nameDistanceInternal_;
}

std::string getPoint(const IdTable* restable, size_t row, ColumnIndex col) const;

// this function computes the bounding box(es), which represent all points, which
// are in reach of the starting point with a distance of at most maxDistanceInMeters
std::vector<box> computeBoundingBox(const point& startPoint);
Expand Down Expand Up @@ -125,7 +123,7 @@ class SpatialJoin : public Operation {

// helper function, which gets the point of an id table
std::optional<GeoPoint> getPoint(const IdTable* restable, size_t row,
ColumnIndex col);
ColumnIndex col) const;

// helper function, which computes the distance of two points, where each
// point comes from a different result table
Expand Down
9 changes: 0 additions & 9 deletions src/global/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,6 @@ static const std::string MAX_DIST_IN_METERS = "<max-distance-in-meters:";
static constexpr auto MAX_DIST_IN_METERS_REGEX =
ctll::fixed_string{"<max-distance-in-meters:[0-9]+>"};

// this predicate is the identifier for the SpatialJoin class. It joins the two
// objects, if their distance is smaller or equal to the maximum distance, which
// needs to be given in the predicate as well. The syntax for the predicate
// needs to be like this: <max-distance-in-meters:XXXX>, where XXXX needs to be
// replaced by an integer number.
static const std::string MAX_DIST_IN_METERS = "<max-distance-in-meters:";
static constexpr auto MAX_DIST_IN_METERS_REGEX =
ctll::fixed_string{"<max-distance-in-meters:[0-9]+>"};

// TODO<joka921> Move them to their own file, make them strings, remove
// duplications, etc.
constexpr inline char XSD_STRING[] = "http://www.w3.org/2001/XMLSchema#string";
Expand Down
22 changes: 3 additions & 19 deletions test/engine/SpatialJoinTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1810,16 +1810,6 @@ TEST(SpatialJoin, getSizeEstimate) {
testMultiplicitiesOrSizeEstimate(true, false);
}

TEST(SpatialJoin, getCostEstimateBaselineAlgorithm) {
// onlyForTestingSetUseBaselineAlgorithm(true);
ASSERT_TRUE(false); // TODO
}

TEST(SpatialJoin, getCostEstimateBoundingBoxAlgorithm) {
// onlyForTestingSetUseBaselineAlgorithm(false);
ASSERT_TRUE(false); // TODO
}

} // namespace getMultiplicityAndSizeEstimate

namespace boundingBox {
Expand All @@ -1832,20 +1822,14 @@ typedef bg::model::box<point> box;
typedef std::pair<point, size_t> value;

inline void testBoundingBox(const long long& maxDistInMeters, const point& startPoint) {
auto convertToStr = [](const point& point1) {
auto lon = absl::StrFormat("%.6f", point1.get<0>());
auto lat = absl::StrFormat("%.6f", point1.get<1>());
return absl::StrCat("POINT(", lon, " ", lat, ")");
};

auto checkOutside = [&](const point& point1, const point& startPoint,
const std::vector<box>& bbox, SpatialJoin* spatialJoin) {
// check if the point is contained in any bounding box
bool within = spatialJoin->containedInBoundingBoxes(bbox, point1);
if (!within) {
std::string strp1 = convertToStr(point1);
std::string strp2 = convertToStr(startPoint);
double dist = ad_utility::detail::wktDistImpl(strp1, strp2) * 1000;
GeoPoint geo1{point1.get<1>(), point1.get<0>()};
GeoPoint geo2{startPoint.get<1>(), startPoint.get<0>()};
double dist = ad_utility::detail::wktDistImpl(geo1, geo2) * 1000;
ASSERT_GT(static_cast<long long>(dist), maxDistInMeters);
}
};
Expand Down

0 comments on commit a9eb289

Please sign in to comment.