2022_07杂记

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;

在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值