spark sql怎么去获取hive 表一定日期范围内的数据 10
我现在需要去hive表当中读取数据,读取数据时是以日期为条件获取一个时间段内的数据,在hive当中操作是可以获取的但是在sparkSQL当中获取不到。hive表操作语句是...
我现在需要去hive表当中读取数据,读取数据时是以日期为条件获取一个时间段内的数据,在hive当中操作是可以获取的但是在spark SQL当中获取不到。hive表操作语句是OK的,hive语句如下:
SELECT id,merchant_no,sku_id,stock_no,change_count,stock_count_snapshoot,create_time,order_id,stock_type,start_time FROM stock_data WHERE merchant_no='a69683' and cast(start_time as date) between '2017-09-01' and '2017-09-10'; 展开
SELECT id,merchant_no,sku_id,stock_no,change_count,stock_count_snapshoot,create_time,order_id,stock_type,start_time FROM stock_data WHERE merchant_no='a69683' and cast(start_time as date) between '2017-09-01' and '2017-09-10'; 展开
1个回答
展开全部
select orderid,fenjian,timee
from
(
select orderid,fenjian,timee,row_number(orderid,fenjian) rn
from (
select orderid,fenjian,timee from tableName
distribute by orderid,fenjian sort by orderid,fenjian,timee asc
) t1
) t2
where t2.rn=1
from
(
select orderid,fenjian,timee,row_number(orderid,fenjian) rn
from (
select orderid,fenjian,timee from tableName
distribute by orderid,fenjian sort by orderid,fenjian,timee asc
) t1
) t2
where t2.rn=1
追问
您好,能够详述一下吗
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询