通过doris-kafka-connector-1.1消费kafka消息报错

Viewed 10

问题一:
消息是一个json串,如:
{
"user_id":6,
"name":"Alexander",
"age":60,
"time": 1754555721
}
以上消息消费会报错,错误信息如下:
Reason: Parse json data for JsonDoc failed. code: 4, error info: Missing a name for object member.. src line [{];
Reason: Parse json data for JsonDoc failed. code: 2, error info: The document root must not be followed by other values.. src line [ "user_id":5,"];
Reason: Parse json data for JsonDoc failed. code: 3, error info: Invalid value.. src line [ name":"Alexander",];
Reason: Parse json data for JsonDoc failed. code: 2, error info: The document root must not be followed by other values.. src line [ "age":60,"];
Reason: Parse json data for JsonDoc failed. code: 3, error info: Invalid value.. src line [ time": 1754555720];
Reason: Parse json data for JsonDoc failed. code: 3, error info: Invalid value.. src line [}];

但同样的内容,把换行去掉,改成:
{"user_id":6,"name":"Alexander","age":60,"time": 1754555721}
则消费成功。

问题二:
{"user_id":6,"name":"Alexander","age":60,"time": 1754555721}这个消息插入doris后发现time字段为空,doris中time字段为datetime类型。

1 Answers

插入不报错了,但time字段(timestamp)转化后插入到doris的time字段(datetime)时间相差8小时,配置信息如下:
image.png

kafka中消息内容"time":1754468599 ,对应东八区的时间应为“2025-8-6 16:23:19”,但实际上插入到doris后变成了“2025-08-06 08:23:19”。
doris中本身的时区是东八区
image.png