今天在使用presto查数据时,遇到一个诡异的问题,相同的sql,每次查询的结果确不一样,sql如下
selectt1.orderid,t1.ext,t2.idfrom ( select distinct orderid,ext from odl_order_detail_cps where billdate>='2019-05-06' and order_type=1 and isbill=1) t1left join dim_short_link_cps t2 on cast(t1.ext as int)=t2.id;
执行很多次,每次的结果数都不一样,查了很多资料都无济于事,后来猜测是不是ext转int时报错了,在有些节点上执行失败,调整sql如下
selectt1.orderid,t1.ext,t2.idfrom ( select distinct orderid,ext from odl_order_detail_cps where billdate>='2019-05-06' and order_type=1 and isbill=1) t1left join dim_short_link_cps t2 on t1.ext=cast(t2.id as varchar);
结果竟然正常了,证实了上面的猜测。
这种错误是因为ext参数有null的情况,在cast转换时,出错了,然后造成节点的任务失败,所以结果是执行正常的节点返回的数据。
在hive中就不存在这样的问题
欢迎订阅「K叔区块链」 - 专注于区块链技术学习
博客地址:http://www.jouypub.com
简书主页:https://www.jianshu.com/u/756c9c8ae984
segmentfault主页:https://segmentfault.com/blog/jouypub
腾讯云主页:https://cloud.tencent.com/developer/column/72548