Skip to content

Commit 1f82586

Browse files
committed
SEDONA-725 Add pyflink to Sedona.
1 parent 6720823 commit 1f82586

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

python/tests/flink/test_flink_registration.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
from pyflink.table import StreamTableEnvironment
2-
from pyflink.table.udf import ScalarFunction, udf
31
from shapely.wkb import loads
42
import pytest
53

64

7-
class Buffer(ScalarFunction):
8-
def eval(self, s):
9-
geom = loads(s)
10-
return geom.buffer(1).wkb
11-
12-
135
@pytest.mark.flink
14-
def test_register(table_env: StreamTableEnvironment):
6+
def test_register(table_env):
157
result = (
168
table_env.sql_query("SELECT ST_ASBinary(ST_Point(1.0, 2.0))")
179
.execute()
@@ -22,7 +14,14 @@ def test_register(table_env: StreamTableEnvironment):
2214

2315

2416
@pytest.mark.flink
25-
def test_register_udf(table_env: StreamTableEnvironment):
17+
def test_register_udf(table_env):
18+
from pyflink.table.udf import ScalarFunction, udf
19+
20+
class Buffer(ScalarFunction):
21+
def eval(self, s):
22+
geom = loads(s)
23+
return geom.buffer(1).wkb
24+
2625
table_env.create_temporary_function(
2726
"ST_BufferPython", udf(Buffer(), result_type="Binary")
2827
)

0 commit comments

Comments
 (0)