jiayuasu commented on code in PR #1066:
URL: https://github.com/apache/sedona/pull/1066#discussion_r1379121564
##########
spark/common/src/test/scala/org/apache/sedona/sql/dataFrameAPITestScala.scala:
##########
@@ -193,9 +193,27 @@ 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, 'side=left' as params")
+ var dfLine = linestringDf.select(ST_Buffer("geom", 10,
"params").as("geom")).selectExpr("ST_ReducePrecision(geom, 2)")
Review Comment:
Are you able to pass in `side=left` as the value directly instead of using
column name?
##########
spark/common/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/st_functions.scala:
##########
Review Comment:
Please also add to Sedona Python dataframe API
--
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]