iGN5117 commented on code in PR #878:
URL: https://github.com/apache/sedona/pull/878#discussion_r1246972419
##########
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:
Have added candidates 1, 2, 5, 10. These yield result 100, 298, 688, 1258
respectively for a sample size of 100
--
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]