Support for executable UDF
arnaudbriche opened this issue · comments
Does chdb support executable UDF functions ?
If so, how do we configure chdb ?
chDB is ClickHouse, so all things would be like executable UDF functions
Here is an example:
root@0a8b55995b6e:/auxten/chdb/tests# python3 udf3.py
"Value 2"
udf3.py
import chdb
ret = chdb.query(
"SELECT test_function_python(toUInt64(2));",
udf_path="/auxten/chdb/tests/.udf",
)
print(ret)
.udf/udf.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>
</function>
</functions>
DO NOT forget chmod +x .udf/test_function.py
.udf/test_function.py
#!/usr/bin/python3
import sys
if __name__ == '__main__':
for line in sys.stdin:
print("Value " + line, end='')
sys.stdout.flush()