我有一张这样的表
- seek_video 2014-08-30 11:26:06 NULL 9 0
- seek_video 2014-08-30 11:26:13 NULL 0 5
- seek_video 2014-08-30 11:26:13 NULL 5.07195 0
- seek_video 2014-08-31 11:05:24 NULL 330.94054 312
- seek_video 2014-08-31 11:38:30 NULL 220 229
- seek_video 2014-08-31 11:51:15 NULL 323.833366 345
- seek_video 2014-08-31 11:51:16 NULL 346.223424 367
- seek_video 2014-08-31 11:51:16 NULL 367.879296 380
- seek_video 2014-08-31 11:51:17 NULL 381.625192 397
- seek_video 2014-08-31 11:51:19 NULL 309.719715 323
- seek_video 2014-08-31 11:34:33 NULL 440.885152 309
- seek_video 2014-08-31 11:46:04 NULL 255.366326 268
- seek_video 2014-08-31 11:46:05 NULL 268 290
- seek_video 2014-08-31 11:46:07 NULL 290 309
- seek_video 2014-08-31 11:44:34 NULL 231.77611 250
- seek_video 2014-08-31 11:34:58 NULL 272 220
- seek_video 2014-08-31 11:34:55 NULL 299 272
- seek_video 2014-08-31 11:34:53 NULL 309 299
- seek_video 2014-08-31 12:16:29 NULL 501.779488 489
- seek_video 2014-08-31 12:26:32 NULL 551.362232 578
- seek_video 2014-08-31 12:26:35 NULL 580.790634 625
- seek_video 2014-08-31 12:26:37 NULL 627.838707 663
- seek_video 2014-08-31 12:26:38 NULL 663.573627 649
- seek_video 2014-08-31 12:26:39 NULL 650.194875 637
- seek_video 2014-08-31 12:26:42 NULL 639.451178 621
- seek_video 2014-08-31 07:58:51 NULL 9.075397 9
- seek_video 2014-08-31 07:58:52 NULL 9 4
- seek_video 2014-08-31 08:13:59 NULL 19.630148 27
我的查询
select max(old_time),max(new_time) from (
select event_type,time,currenttime,old_time,new_time
from vi_log_table
where *************) t1 ;
最后两列的最大值返回9.075397 9
而不是650.19 663
我对这种不可预测的行为感到很困惑。在hive中处理浮点值时存在一些问题。
按时间顺序编辑,将值排序为
答案 0 :(得分:0)
我找到了。
在HIVEQL中,我最后两行的数据类型是字符串 使用
cast(new_time as float)
会给出正确的订单