iGN5117 commented on code in PR #878:
URL: https://github.com/apache/sedona/pull/878#discussion_r1246951826
##########
sql/common/src/test/scala/org/apache/sedona/sql/predicateJoinTestScala.scala:
##########
@@ -403,7 +403,41 @@ class predicateJoinTestScala extends TestBaseScala {
assert(distanceJoinDf.queryExecution.sparkPlan.collect { case p:
DistanceJoinExec => p }.size === 1)
assert(distanceJoinDf.count() == expected)
})
+ }
+
+ it("Passed ST_HausdorffDistance in a spatial join") {
+ val sampleCount = 100
+ val distanceCandidates = Seq(1, 2)
+ val densityFrac = 0.6
+ val inputPoint = buildPointDf.limit(sampleCount).repartition(5)
+ val inputPolygon = buildPolygonDf.limit(sampleCount).repartition(3)
+ distanceCandidates.foreach(distance => {
+
+ //DensityFrac specified, <= distance
+ val expectedDensityIntersects =
bruteForceDistanceJoinHausdorff(sampleCount, distance, densityFrac, true)
+ val distanceDensityIntersectsDF =
inputPoint.alias("pointDF").join(inputPolygon.alias("polygonDF"),
expr(s"ST_HausdorffDistance(pointDF.pointshape, polygonDF.polygonshape,
$densityFrac) <= $distance"))
+ assert(distanceDensityIntersectsDF.queryExecution.sparkPlan.collect {
case p: DistanceJoinExec => p }.size === 1)
+ assert(distanceDensityIntersectsDF.count() ==
expectedDensityIntersects)
Review Comment:
Sure, both intersects (<=) and non-intersects (<) return a count of 100 for
this dataset. The polygon-point pairs are also exactly same since there is no
pair with frechetDistance == 1
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]