hive是否可以创建临时表,以便获得一个小表以供进一步查询?

t1rydlwq  于 2021-06-27  发布在  Hive
关注(0)|答案(0)|浏览(170)

我有一个表,架构如下:

struct TBL{
   1:optional string category;
   2:optional string endpoint; 
   3:optional string priority; 
   4:optional i64 timestap;
   5:optional string traceId;   
   6:optional string rpcId;     
   7:optional string businessId;
   8:optional string message;   
   9:optional int date;    
}

我只关心
8:optional string message; message 字段是 log .
我有一个URL列表,其中一些可以在 message 提出。我需要找到哪些网址可以在表中找到。在 message 文件中,url总是附带 "getRequestURL" 例如

10.128.226.31,[INFO  2019-03-13 10:00:18.770] [resin-port-9300-44] [aaaLiMKyYK9bNbetoyhLw_-301570423] com.example.cashpay.filter.StaticFilter.doFilter(StaticFilter.java:99) [getRequestURL=http://www.example.com/merchant/deduct/query/v3]

这张table很大。我想先过滤表,说:

select message from TBL where message like '%getRequestURL%' and date ='20190319'

然后我可以使用union查询找到上面过滤表中的url。说:

select 'com/res/doc/eula/help.html', count(1) from filtered_tbl where message like 'com/res/doc/eula/help.html'
    union
    select 'com/charge/bank/alipay_wap/', count(1) from filtered_tbl where message like 'com/charge/bank/'
    union
    select 'com/reductionActivity/queryRegisterStatus', count(1) from filtered_tbl where message like 'com/reductionActivity/queryRegisterStatus'
    union
    select 'com/charge/pushcmd', count(1) from filtered_tbl where message like 'com/charge/pushcmd'
union......

Hive是否支持先过滤?如果它支持,那么我能做什么?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题