1、spark引擎之前碰到过数据问题,运算无效,值为0。select 得到的结果正常,insert就成为0了。
原因:spark引擎数据如果是bigint,落表字段类型是int的话,就会为0。
union 的时候也要注意,各字段对应类型是否一致,如有int 有bigint,落表也会数据不准确。坑的是不报错,测试工程师测试才发现出来。
2、Holo 的 视图
create table crm.holo_test (
amount decimal(10, 2),
rate decimal(10, 2)
);
insert into crm.holo_test values
(12.12,13.13),
(14.14,15.15),
(16.16,17.17),
(17.1,17),
(18.01,19);
create view crm.holo_view as select * from crm.holo_test;
select * from crm.holo_view;
insert into crm.holo_test values
(27,32);
select * from crm.holo_view;
create table crm.holo_test_2 (
amount decimal(10, 2),
rate decimal(10, 2)
);
insert into crm.holo_test_2 values
(12.12,14.13),
(14.14,16.15);
create view crm.holo_view_2 as select t1.amount,t2.amount as amount2,t2.rate from crm.holo_test t1 left join crm.holo_test_2 t2
ON t1.amount = t2.amount;
select * from crm.holo_view_2;
insert into crm.holo_test_2 values
(27,33);
select * from crm.holo_view_2;