jiayuasu commented on code in PR #1066:
URL: https://github.com/apache/sedona/pull/1066#discussion_r1378299772
##########
docs/api/flink/Function.md:
##########
@@ -530,21 +530,51 @@ Output: `LINESTRING Z(-1 -1 0, 10 5 5)`
Introduction: Returns a geometry/geography that represents all points whose
distance from this Geometry/geography is less than or equal to distance.
-Format: `ST_Buffer (A: Geometry, buffer: Double)`
+The optional third parameter controls the buffer accuracy and style. Buffer
accuracy is specified by the number of line segments approximating a quarter
circle, with a default of 8 segments. Buffer style can be set by providing
blank-separated key=value pairs in a list format.
-Since: `v1.2.0`
+- `quad_segs=#` : Number of line segments utilized to approximate a quarter
circle (default is 8).
+- `endcap=round|flat|square` : End cap style (default is `round`). `butt` is
an accepted synonym for `flat`.
+- `join=round|mitre|bevel` : Join style (default is `round`). `miter` is an
accepted synonym for `mitre`.
+- `mitre_limit=#.#` : mitre ratio limit and it only affects mitred join style.
`miter_limit` is an accepted synonym for `mitre_limit`.
+- `side=both|left|right` : The option `left` or `right` enables a single-sided
buffer operation on the geometry, with the buffered side aligned according to
the direction of the line. This functionality is specific to LINESTRING
geometry and has no impact on POINT or POLYGON geometries. By default, square
end caps are applied.
Review Comment:
What is the default value of `side`?
##########
spark/common/src/test/scala/org/apache/sedona/sql/dataFrameAPITestScala.scala:
##########
@@ -193,9 +193,24 @@ class dataFrameAPITestScala extends TestBaseScala {
it("Passed ST_Buffer") {
val polygonDf = sparkSession.sql("SELECT ST_Point(1.0, 1.0) AS geom")
val df = polygonDf.select(ST_Buffer("geom",
1.0).as("geom")).selectExpr("ST_ReducePrecision(geom, 2)")
- val actualResult = df.take(1)(0).get(0).asInstanceOf[Geometry].toText()
- val expectedResult = "POLYGON ((1.98 0.8, 1.92 0.62, 1.83 0.44, 1.71
0.29, 1.56 0.17, 1.38 0.08, 1.2 0.02, 1 0, 0.8 0.02, 0.62 0.08, 0.44 0.17, 0.29
0.29, 0.17 0.44, 0.08 0.62, 0.02 0.8, 0 1, 0.02 1.2, 0.08 1.38, 0.17 1.56, 0.29
1.71, 0.44 1.83, 0.62 1.92, 0.8 1.98, 1 2, 1.2 1.98, 1.38 1.92, 1.56 1.83, 1.71
1.71, 1.83 1.56, 1.92 1.38, 1.98 1.2, 2 1, 1.98 0.8))"
- assert(actualResult == expectedResult)
+ var actual = df.take(1)(0).get(0).asInstanceOf[Geometry].toText()
+ var expected = "POLYGON ((1.98 0.8, 1.92 0.62, 1.83 0.44, 1.71 0.29,
1.56 0.17, 1.38 0.08, 1.2 0.02, 1 0, 0.8 0.02, 0.62 0.08, 0.44 0.17, 0.29 0.29,
0.17 0.44, 0.08 0.62, 0.02 0.8, 0 1, 0.02 1.2, 0.08 1.38, 0.17 1.56, 0.29 1.71,
0.44 1.83, 0.62 1.92, 0.8 1.98, 1 2, 1.2 1.98, 1.38 1.92, 1.56 1.83, 1.71 1.71,
1.83 1.56, 1.92 1.38, 1.98 1.2, 2 1, 1.98 0.8))"
+ assertEquals(expected, actual)
+
+ var linestringDf = sparkSession.sql("SELECT ST_GeomFromWKT('LINESTRING(0
0, 50 70, 100 100)') AS geom")
Review Comment:
All these changes here are wrong. They didn't test the DataFrame style APIs.
Please carefully read the test cases here. You also need to update DataFrameAPI
in both Sedona Spark Scala and Python to add new variants of ST_Buffer
DataFrame APIs
--
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]