doris & StarRocks 错题本

本文介绍了在使用Spark Streaming过程中遇到的数据写入失败问题,问题源于列分隔符设置不当,解决方案是使用转义字符。另外,讨论了SQL建表时的错误,指出UNIQUE KEY应作为所有字段的前缀并保持有序。最后,文章揭示了在StarRocks中因数据类型不匹配导致的写入错误,特别是tinyint与int类型的冲突,解决方法是调整列的类型为int。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一,spark streaming load写入失败

Reason: column count mismatch, expect=25 real=1. src line: [demo-masking	1	2018-02-17	1	B35C300672_1	B600FA855B	72d2b68c1f79fd73d8910ff388685ab0	9cac8970477ec95540ec64a1b2450ee3	2	0.0070	3	0.0076	1.0000	0	0	0.0000	0.0000		0.00	0.00	0	0	0	2018-02-21 21:38:05	2018-02-21 21:38:05]; 
Reason: column count mismatch, expect=25 real=1. src line: [demo-masking	1	2018-02-19	1	B35C300672_1	B600FA855B	72d2b68c1f79fd73d8910ff388685ab0	9cac8970477ec95540ec64a1b2450ee3	2	0.0038	2	0.0030	1.0000	0	0	0.0000	0.0000		0.00	0.00	0	0	0	2018-02-21 21:36:17	2018-02-21 21:36:17]; 

在这里插入图片描述

原因是分隔符设置为"\t",没有加转义字符,改为"\\t"即正常。

二,SQL 错误 [1064] [42000]: Key columns should be a ordered prefix of the schema.

建表时UNIQUE KEY必须放在所有字段前面声明且保证有序

三,Reason: column(type)) value is null while columns is not nullable. src line: [[‘finance’, ‘15’, ‘100001’, ‘152’, ‘0’, ‘2021-11-03T11:55:57’, ‘2021-11-03T11:55:57’, ‘0’]];

写入StarRocks时报错,但对应的数据并不为空。

Reason: column(type)) value is null while columns is not nullable. src line: [['finance', '16', '100001', '153', '0', '2021-11-03T11:55:57', '2021-11-03T11:55:57', '0']]; 
Reason: column(type)) value is null while columns is not nullable. src line: [['finance', '3', '1', '152', '0', '2021-10-20T18:03:12', '2021-10-20T18:03:12', '0']]; 

原因是type对应的类型在StarRocks建表是是tinyint,导致int类型的值插不进去。

解决办法:将type的类型改为int

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小手追梦

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值