Skip to content

Commit 3a42f06

Browse files
committed
fix pre commit
1 parent c800c9a commit 3a42f06

File tree

4 files changed

+25
-15
lines changed

4 files changed

+25
-15
lines changed

python/tests/utils/test_sedona_db_vectorized_udf.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# under the License.
1717

1818
import numpy as np
19+
import pyspark
1920
import pytest
2021

2122
from sedona.spark.sql.functions import sedona_db_vectorized_udf
@@ -32,6 +33,10 @@
3233
class TestSedonaDBArrowFunction(TestBase):
3334

3435
@pytest.mark.vectorized
36+
@pytest.mark.skipif(
37+
pyspark.__version__ >= "4.0.0",
38+
reason="Skip for pyspark > 4.0",
39+
)
3540
def test_vectorized_udf(self):
3641
@sedona_db_vectorized_udf(
3742
return_type=GeometryType(), input_types=[ByteType(), IntegerType()]
@@ -57,6 +62,10 @@ def my_own_function(geom, distance):
5762
df.select(ST_X(my_own_function(df.wkt, lit(100)).alias("geom"))).show()
5863

5964
@pytest.mark.vectorized
65+
@pytest.mark.skipif(
66+
pyspark.__version__ >= "4.0.0",
67+
reason="Skip for pyspark > 4.0",
68+
)
6069
def test_geometry_to_double(self):
6170
@sedona_db_vectorized_udf(return_type=DoubleType(), input_types=[ByteType()])
6271
def geometry_to_non_geometry_udf(geom):
@@ -82,6 +91,10 @@ def geometry_to_non_geometry_udf(geom):
8291
assert values_list == [1.0, 2.0, 3.0]
8392

8493
@pytest.mark.vectorized
94+
@pytest.mark.skipif(
95+
pyspark.__version__ >= "4.0.0",
96+
reason="Skip for pyspark > 4.0",
97+
)
8598
def test_geometry_to_int(self):
8699
@sedona_db_vectorized_udf(return_type=IntegerType(), input_types=[ByteType()])
87100
def geometry_to_int(geom):
@@ -106,6 +119,10 @@ def geometry_to_int(geom):
106119
assert values_list == [0, 0, 0]
107120

108121
@pytest.mark.vectorized
122+
@pytest.mark.skipif(
123+
pyspark.__version__ >= "4.0.0",
124+
reason="Skip for pyspark > 4.0",
125+
)
109126
def test_geometry_crs_preservation(self):
110127
@sedona_db_vectorized_udf(return_type=GeometryType(), input_types=[ByteType()])
111128
def return_same_geometry(geom):

spark/spark-3.5/src/test/scala/org/apache/sedona/sql/TestBaseScala.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import org.scalatest.{BeforeAndAfterAll, FunSpec}
2626
import org.testcontainers.containers.MinIOContainer
2727

2828
import java.io.FileInputStream
29-
3029
import java.util.concurrent.ThreadLocalRandom
3130

3231
trait TestBaseScala extends FunSpec with BeforeAndAfterAll {

spark/spark-3.5/src/test/scala/org/apache/spark/sql/udf/StrategySuite.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ class StrategySuite extends TestBaseScala with Matchers {
3636
import spark.implicits._
3737

3838
it("sedona geospatial UDF - geopandas") {
39+
if (!sparkSession.version.startsWith("3.5")) {
40+
cancel("spark 3.5 is supported only.")
41+
}
42+
3943
val df = Seq(
4044
(1, "value", wktReader.read("POINT(21 52)")),
4145
(2, "value1", wktReader.read("POINT(20 50)")),
@@ -61,6 +65,10 @@ class StrategySuite extends TestBaseScala with Matchers {
6165
}
6266

6367
it("sedona geospatial UDF - sedona db") {
68+
if (!sparkSession.version.startsWith("3.5")) {
69+
cancel("spark 3.5 is supported only.")
70+
}
71+
6472
val df = Seq(
6573
(1, "value", wktReader.read("POINT(21 52)")),
6674
(2, "value1", wktReader.read("POINT(20 50)")),

spark/spark-3.5/src/test/scala/org/apache/spark/sql/udf/TestScalarPandasUDF.scala

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -209,20 +209,6 @@ object ScalarUDF {
209209
pythonEvalType = UDF.PythonEvalType.SQL_SCALAR_SEDONA_UDF,
210210
udfDeterministic = true)
211211

212-
val nonGeometryVectorizedUDF: UserDefinedPythonFunction = UserDefinedPythonFunction(
213-
name = "vectorized_udf",
214-
func = SimplePythonFunction(
215-
command = vectorizedFunction,
216-
envVars = workerEnv.clone().asInstanceOf[java.util.Map[String, String]],
217-
pythonIncludes = List.empty[String].asJava,
218-
pythonExec = pythonExec,
219-
pythonVer = pythonVer,
220-
broadcastVars = List.empty[Broadcast[PythonBroadcast]].asJava,
221-
accumulator = null),
222-
dataType = FloatType,
223-
pythonEvalType = PythonEvalType.SQL_SCALAR_PANDAS_UDF,
224-
udfDeterministic = false)
225-
226212
val sedonaDBGeometryToGeometryFunction: UserDefinedPythonFunction = UserDefinedPythonFunction(
227213
name = "geospatial_udf",
228214
func = SimplePythonFunction(

0 commit comments

Comments
 (0)