diff --git a/src/engine/SpatialJoin.cpp b/src/engine/SpatialJoin.cpp index 4f96b091a..9c981399f 100644 --- a/src/engine/SpatialJoin.cpp +++ b/src/engine/SpatialJoin.cpp @@ -222,7 +222,7 @@ std::string SpatialJoin::betweenQuotes(std::string extractFrom) const { } std::optional 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()} diff --git a/src/engine/SpatialJoin.h b/src/engine/SpatialJoin.h index 10b6ebc86..bd5a13f24 100644 --- a/src/engine/SpatialJoin.h +++ b/src/engine/SpatialJoin.h @@ -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 computeBoundingBox(const point& startPoint); @@ -125,7 +123,7 @@ class SpatialJoin : public Operation { // helper function, which gets the point of an id table std::optional 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 diff --git a/src/global/Constants.h b/src/global/Constants.h index b3ef3f257..26cb31812 100644 --- a/src/global/Constants.h +++ b/src/global/Constants.h @@ -106,15 +106,6 @@ static const std::string MAX_DIST_IN_METERS = ""}; -// 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: , where XXXX needs to be -// replaced by an integer number. -static const std::string MAX_DIST_IN_METERS = ""}; - // TODO Move them to their own file, make them strings, remove // duplications, etc. constexpr inline char XSD_STRING[] = "http://www.w3.org/2001/XMLSchema#string"; diff --git a/test/engine/SpatialJoinTest.cpp b/test/engine/SpatialJoinTest.cpp index f31d6efda..6784ef479 100644 --- a/test/engine/SpatialJoinTest.cpp +++ b/test/engine/SpatialJoinTest.cpp @@ -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 { @@ -1832,20 +1822,14 @@ typedef bg::model::box box; typedef std::pair 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& 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(dist), maxDistInMeters); } };