ClickHouse原生支持很多种方式自定义UDF,但是按照官方给的示例操作时发现一些问题。
报错例如:
Broken pipe: While executing TabSeparatedRowOutputFormat: While processing test_function_python(toUInt64(2)). (CANNOT_WRITE_TO_FILE_DESCRIPTOR)
以下是根据官方介绍来操作并成功注册了Python方式的UDF。
ClickHouse版本:22.8
Python版本 官方只支持python3
操作步骤:
1.先将xml文件放在ClickHouse安装目录,同config.xml同层级。
<functions>
<function>
<type>executable</type>
<name>test_function_python</name>
<return_type>String</return_type>
<argument>
<type>UInt64</type>
<name>value</name>
</argument>
<format>TabSeparated</format>
<command>test_function.py</command>
< -- <execute_direct>0</execute_direct> -> 该参数可选,默认为1,更改后可将command参数修改为 /xx/