You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@streampark.apache.org by GitBox <gi...@apache.org> on 2023/01/24 08:09:21 UTC

[GitHub] [incubator-streampark] 0akarma edited a discussion: Python UDF not work in sql mode

GitHub user 0akarma edited a discussion: Python UDF not work in sql mode

I have tested these two ways setting python udf function in sql-client , they worked well.
But when I tried to set `Dynamic Properties`, `Program Args`, `flink-conf.yaml` and `sql code` in streampark, but they are not worked well :(
I have no idea about the differences between `org.apache.streampark.flink.cli.SqlClient`and  the  origin ` SqlClient` .
```
# Way 1
bin/sql-client.sh \
-pyexec /opt/flink_data/requirements/py_env/jm_venv/bin/python3.7 \
-pyclientexec /opt/flink_data/requirements/py_env/jm_venv/bin/python3.7 \
-pyfs file:///opt/flink_data/requirements/udfs

# Way 2
Flink SQL> SET 'python.client.executable'='/opt/flink_data/requirements/py_env/jm_venv/bin/python3.7';
[INFO] Session property has been set.

Flink SQL> SET 'python.executable'='/opt/flink_data/requirements/py_env/jm_venv/bin/python3.7';
[INFO] Session property has been set.

Flink SQL> SET 'python.files'='file:///opt/flink_data/requirements/udfs';
[INFO] Session property has been set.


# the way to registry udf function
Flink SQL> CREATE TEMPORARY FUNCTION is_domain AS 'python_udf.is_domain' LANGUAGE PYTHON;
[INFO] Execute statement succeed.

# the way to use udf function
Flink SQL> select is_domain('www.google.com');

```

GitHub link: https://github.com/apache/incubator-streampark/discussions/2264

----
This is an automatically sent email for dev@streampark.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@streampark.apache.org