一,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