Doris 2.0版本 执行远程UDF,函数入参包含VARCHAR类型一直提示 [E1003]Missing required fields in request; 1.2.6版本无此问题 #23707
Unanswered
bedgay
asked this question in
A - General / Q&A
Replies: 2 comments 1 reply
-
|
换了Version : doris-1.2.6-rc03的版本重新测试,远程UDF函数入参VARCHAR的测试通过 |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
fix #23832 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
一、Doris版本
Version : doris-2.0.0-rc04
二、问题描述
使用Doris samples/doris-demo/remote-udf-java-demo 远程UDF做测试时候,发现入参如果是VARCHAR类型一直无法通过测试
使用的数据结构为官方文档中 [快速开始] 中使用的 demo.example_tbl https://doris.apache.org/zh-CN/docs/1.2/get-starting/
三、问题过程
1、按照官方文档中 [快速开始] 中创建数据库和表,如下:
`use demo;
CREATE TABLE IF NOT EXISTS demo.example_tbl
(
user_idLARGEINT NOT NULL COMMENT "用户id",dateDATE NOT NULL COMMENT "数据灌入日期时间",cityVARCHAR(20) COMMENT "用户所在城市",ageSMALLINT COMMENT "用户年龄",sexTINYINT COMMENT "用户性别",last_visit_dateDATETIME REPLACE DEFAULT "1970-01-01 00:00:00" COMMENT "用户最后一次访问时间",costBIGINT SUM DEFAULT "0" COMMENT "用户总消费",max_dwell_timeINT MAX DEFAULT "0" COMMENT "用户最大停留时间",min_dwell_timeINT MIN DEFAULT "99999" COMMENT "用户最小停留时间")
AGGREGATE KEY(
user_id,date,city,age,sex)DISTRIBUTED BY HASH(
user_id) BUCKETS 1PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);`
2、IDEA中编写远程UDF函数RPC服务端
拷贝官方案例做简单修改 samples/doris-demo/remote-udf-java-demo
核心逻辑为,将VARCHAR的字段都拼接上 "_test"后返回, 核心代码如下:(没有截全)
` @OverRide
public void fnCall(FunctionService.PFunctionCallRequest request,
StreamObserver<FunctionService.PFunctionCallResponse> responseObserver) {
// symbol is functionName
String functionName = request.getFunctionName();
logger.info("udaf fnCall request=" + request);
FunctionService.PFunctionCallResponse.Builder res = FunctionService.PFunctionCallResponse.newBuilder();
// resUDF = FunctionMethodService.add_int(request);
logger.info("fnCall res=" + res);
ok(responseObserver, resUDF);
return;
CREATE FUNCTION rpc_add_int(VARCHAR(20)) RETURNS VARCHAR(20) PROPERTIES (
"SYMBOL"="add_int",
"OBJECT_FILE"="192.168.3.149:9999",
"TYPE"="RPC"
);
select rpc_add_int(city) from demo.example_tbl;`
4、执行报错截图

四、尝试解决
1、先上解决结论:
按照报错提示,顺藤摸瓜到了BE 和 brpc,奈何不是C++程序员,解决路子就此卡主了,暂时失焦没了方向(似乎说了句废话,不然也不会来这里Q&A了)
路径:doris-master\be\src\vec\functions\function_rpc.cpp

执行RPC代码:
3、找到brpc项目,根据报错RPC response 返回的 status 搜索 brpc项目,在brpc\docs\cn\error_code.md中找打了相关错误码说明:
EREQUEST
1003
equest序列化错误,client端和server端都可能设置,
形式广泛:"Missing required fields in request: …" "Fail to parse request message, …" "Bad request"
Beta Was this translation helpful? Give feedback.
All reactions