File tree 1 file changed +9
-10
lines changed
1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change 1
- from pyflink .table import StreamTableEnvironment
2
- from pyflink .table .udf import ScalarFunction , udf
3
1
from shapely .wkb import loads
4
2
import pytest
5
3
6
4
7
- class Buffer (ScalarFunction ):
8
- def eval (self , s ):
9
- geom = loads (s )
10
- return geom .buffer (1 ).wkb
11
-
12
-
13
5
@pytest .mark .flink
14
- def test_register (table_env : StreamTableEnvironment ):
6
+ def test_register (table_env ):
15
7
result = (
16
8
table_env .sql_query ("SELECT ST_ASBinary(ST_Point(1.0, 2.0))" )
17
9
.execute ()
@@ -22,7 +14,14 @@ def test_register(table_env: StreamTableEnvironment):
22
14
23
15
24
16
@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
+
26
25
table_env .create_temporary_function (
27
26
"ST_BufferPython" , udf (Buffer (), result_type = "Binary" )
28
27
)
You can’t perform that action at this time.
0 commit comments