jiayuasu commented on code in PR #1208:
URL: https://github.com/apache/sedona/pull/1208#discussion_r1461333345
##########
docs/api/sql/Predicate.md:
##########
@@ -60,9 +60,11 @@ true
## ST_DWithin
-Introduction: Returns true if 'leftGeometry' and 'rightGeometry' are within a
specified 'distance'. This function essentially checks if the shortest distance
between the envelope of the two geometries is <= the provided distance.
+Introduction: Returns true if 'leftGeometry' and 'rightGeometry' are within a
specified 'distance' (in metres). This function essentially checks if the
shortest distance between the envelope of the two geometries is <= the provided
distance.
-Format: `ST_DWithin (leftGeometry: Geometry, rightGeometry: Geometry,
distance: Double)`
+If `useSpheroid` is passed true, ST_DWithin uses Sedona's ST_DistanceSpheroid.
If `useSpheroid` is passed false or not passed at all, DWithin uses Euclidean
distance.
Review Comment:
Please use the same explanation above.
##########
docs/api/flink/Predicate.md:
##########
@@ -60,9 +60,11 @@ true
## ST_DWithin
-Introduction: Returns true if 'leftGeometry' and 'rightGeometry' are within a
specified 'distance'. This function essentially checks if the shortest distance
between the envelope of the two geometries is <= the provided distance.
+Introduction: Returns true if 'leftGeometry' and 'rightGeometry' are within a
specified 'distance' (in metres). This function essentially checks if the
shortest distance between the envelope of the two geometries is <= the provided
distance.
Review Comment:
The explanation should be
Introduction: Returns true if 'leftGeometry' and 'rightGeometry' are within
a specified 'distance'.
If `useSpheroid` is passed `true`, ST_DWithin uses Sedona's
ST_DistanceSpheroid to check the spheroid distance between the centroids of two
geometries. The unit of the distance in this case is meter.
If `useSpheroid` is passed `false`, ST_DWithin uses Euclidean distance and
the unit of the distance is the same as the CRS of the geometries. To obtain
the correct result, please consider using ST_Transform to put data in an
appropriate CRS.
If `useSpheroid` is not given, it defaults to `false`
##########
spark/common/src/test/scala/org/apache/sedona/sql/TestBaseScala.scala:
##########
@@ -95,6 +99,28 @@ trait TestBaseScala extends FunSpec with BeforeAndAfterAll {
sparkSession.read.format("binaryFile").load(path)
}
+
+ def generateTestData(): Seq[(Int, Double, Geometry)] = {
Review Comment:
Manually generating test data is good. But please do not use randomized data
for test because this will create uncertain behaviors in the test and it is
really hard to debug. In addition, please make sure it takes a parameter that
allows to generate any size of test data as desired.
In addition, when create test data for ST_DWithin join, please make sure you
know what the exact number of rows should appear in the result. And you should
always use test cases that produce non-zero results.
--
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]