本文簡要介紹 python 語言中 pyflink.table.TableEnvironment.register_function 的用法。
用法:
register_function(name: str, function: pyflink.table.udf.UserDefinedFunctionWrapper)以唯一名稱注冊 python 用戶定義函數。替換此名稱下已經存在的用戶定義函數。
例子:
>>> table_env.register_function( ... "add_one", udf(lambda i: i + 1, result_type=DataTypes.BIGINT())) >>> @udf(result_type=DataTypes.BIGINT()) ... def add(i, j): ... return i + j >>> table_env.register_function("add", add) >>> class SubtractOne(ScalarFunction): ... def eval(self, i): ... return i - 1 >>> table_env.register_function( ... "subtract_one", udf(SubtractOne(), result_type=DataTypes.BIGINT()))參數:
name- 注冊函數的名稱。
function- 要注冊的 python 用戶定義函數。
版本 1.10.0 中的新函數。
注意:
1.12 中已棄用。請改用
create_temporary_system_function()。
相關用法
- Python pyflink TableEnvironment.register_table_source用法及代碼示例
- Python pyflink TableEnvironment.register_table_sink用法及代碼示例
- Python pyflink TableEnvironment.register_table用法及代碼示例
- Python pyflink TableEnvironment.register_java_function用法及代碼示例
- Python pyflink TableEnvironment.create_temporary_function用法及代碼示例
- Python pyflink TableEnvironment.create_java_temporary_function用法及代碼示例
- Python pyflink TableEnvironment.use_catalog用法及代碼示例
- Python pyflink TableEnvironment.create_temporary_system_function用法及代碼示例
- Python pyflink TableEnvironment.create_temporary_table用法及代碼示例
- Python pyflink TableEnvironment.sql_query用法及代碼示例
- Python pyflink TableEnvironment.create_java_temporary_system_function用法及代碼示例
- Python pyflink TableEnvironment.scan用法及代碼示例
- Python pyflink TableEnvironment.from_path用法及代碼示例
- Python pyflink TableEnvironment.from_elements用法及代碼示例
- Python pyflink TableEnvironment.use_database用法及代碼示例
- Python pyflink TableEnvironment.create_table用法及代碼示例
- Python pyflink TableEnvironment.from_table_source用法及代碼示例
- Python pyflink TableEnvironment.add_python_archive用法及代碼示例
- Python pyflink TableEnvironment.set_python_requirements用法及代碼示例
- Python pyflink TableEnvironment.create_java_function用法及代碼示例
- Python pyflink TableEnvironment.from_pandas用法及代碼示例
- Python pyflink TableEnvironment.from_descriptor用法及代碼示例
- Python pyflink Table.intersect_all用法及代碼示例
- Python pyflink Table.fetch用法及代碼示例
- Python pyflink Table.right_outer_join用法及代碼示例
注:本文由純淨天空篩選整理自apache.org大神的英文原創作品 pyflink.table.TableEnvironment.register_function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
