jiayuasu commented on code in PR #720:
URL: https://github.com/apache/incubator-sedona/pull/720#discussion_r1038640832
##########
sql/src/test/scala/org/apache/sedona/sql/functionTestScala.scala:
##########
@@ -459,6 +459,31 @@ class functionTestScala extends TestBaseScala with
Matchers with GeometrySample
}
+ it("Passed ST_NDims with 2D point") {
+ val test = sparkSession.sql("SELECT ST_NDims(ST_GeomFromWKT('POINT(1
1)'))")
+ assert(test.take(1)(0).get(0).asInstanceOf[Int] == 2)
+ }
+
+ it("Passed ST_NDims with 3D point") {
+ val test = sparkSession.sql("SELECT ST_NDims(ST_GeomFromWKT('POINT(1 1
2)'))")
+ assert(test.take(1)(0).get(0).asInstanceOf[Int] == 3)
+ }
+
+ it("Passed ST_NDims with M coordinates") {
+ val test = sparkSession.sql("SELECT ST_NDims(ST_GeomFromWKT('POINTM(1 1
0.5)'))")
+ assert(test.take(1)(0).get(0).asInstanceOf[Int] == 2)
+ }
+
+ it("Passed ST_NDims with Z coordinates") {
+ val test = sparkSession.sql("SELECT ST_NDims(ST_GeomFromWKT('POINTZ(1 1
0.5)'))")
+ assert(test.take(1)(0).get(0).asInstanceOf[Int] == 3)
+ }
+
+ it("Passed ST_NDims with both Z and M coordinates") {
+ val test = sparkSession.sql("SELECT ST_NDims(ST_GeomFromWKT('POINTZM(1 1
1 0.5)'))")
Review Comment:
According to PostGIS doc (https://postgis.net/docs/ST_NDims.html), XYZM
should return 4, but your case returns 3. If you cannot support M, I am ok with
this. But please clearly state it in the API doc.
--
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]