You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sedona.apache.org by GitBox <gi...@apache.org> on 2022/12/03 00:20:20 UTC

[GitHub] [incubator-sedona] Amrit-Bhaskar-abhask10 commented on a diff in pull request #720: [SEDONA-199] Added ST_NDims to Apache Sedona

Amrit-Bhaskar-abhask10 commented on code in PR #720:
URL: https://github.com/apache/incubator-sedona/pull/720#discussion_r1038644858


##########
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:
   Our Java function does support POINTZM values. And the test cases of Java with POINZM values give the expected result of 4 for `POINTZM(1 1 1 0.5)`. But somehow, the same test case for Scala gives the value of 3.
   For, `POINTM(1 1 0.5)`, In the java test case, we get the output as 3, but in scala, we get the output as 2.



-- 
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: dev-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org