[feature](rpc) (experimental)Support implement UDF through GRPC protocol. (#7519)

Support implement UDF through GRPC protocol. This brings several benefits: 
1. The udf implementation language is not limited to c++, users can use any familiar language to implement udf
2. UDF is decoupled from Doris, udf will not cause doris coredump, udf computing resources are separated from doris, and doris services are not affected

But RPC's UDF has a fixed overhead, so its performance is much slower than C++ UDF, especially when the amount of data is large.

Create function like

```
CREATE FUNCTION rpc_add(INT, INT) RETURNS INT PROPERTIES (
  "SYMBOL"="add_int",
  "OBJECT_FILE"="127.0.0.1:9999",
  "TYPE"="RPC"
);
```
Function service need to implement `check_fn` and `fn_call` methods
Note:
THIS IS AN EXPERIMENTAL FEATURE, THE INTERFACE AND DATA STRUCTURE MAY BE CHANGED IN FUTURE !!!
This commit is contained in:
Zhengguo Yang
2022-02-08 09:25:09 +08:00
committed by GitHub
parent 03f5fc2b0b
commit f8d086d87f
49 changed files with 1765 additions and 370 deletions

View File

@ -38,6 +38,7 @@
#include "exprs/is_null_predicate.h"
#include "exprs/literal.h"
#include "exprs/null_literal.h"
#include "exprs/rpc_fn_call.h"
#include "exprs/scalar_fn_call.h"
#include "exprs/slot_ref.h"
#include "exprs/tuple_is_null_predicate.h"
@ -357,6 +358,8 @@ Status Expr::create_expr(ObjectPool* pool, const TExprNode& texpr_node, Expr** e
*expr = pool->add(new IfNullExpr(texpr_node));
} else if (texpr_node.fn.name.function_name == "coalesce") {
*expr = pool->add(new CoalesceExpr(texpr_node));
} else if (texpr_node.fn.binary_type == TFunctionBinaryType::RPC) {
*expr = pool->add(new RPCFnCall(texpr_node));
} else {
*expr = pool->add(new ScalarFnCall(texpr_node));
}