欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

cannot be used as a grouping expression because its data type map<string,string> is not an orderable

程序员文章站 2022-05-26 17:56:03
...

hive中map类型报错:cannot be used as a grouping expression because its data type map<string,string> is not an orderable data type 解决

--1.创建中间表tmp
create table A.temp as 
select   modify_model model
               ,app_version_name
               ,event_info
               ,imei
               ,server_time
			   ,client_time
               ,category_code
               ,act_code
               ,system_id
from A.dwd_sdk_log_inc_d
where 
              dayno = '20210421' 
              
--2.处理逻辑使用tmp,group by字段中不能有map类型,可以有map里面的key进行分组

  select imei
      ,'BD' searchengine
	  ,model
	  ,app_version_name 
	  ,title
	  ,url
	  ,adid
	  ,count(*)show_pv
  from 
(
         select model
             ,app_version_name 
             ,imei
             ,server_time
             ,if(event_info['Title'] is null,event_info['title'],event_info['Title']) as title
		     ,client_time
		     ,event_info['url']   url
		     ,event_info['adId']  adid
          from (select a.*,row_number() over (partition by model,app_version_name
               ,imei
               ,server_time
			   ,client_time
               ,category_code
               ,act_code
               ,system_id order by imei) as row_num from a.temp a)       
        group by model
                ,app_version_name
                ,imei
		        ,client_time
		        ,event_info['url']  
		        ,event_info['adId'] 
               ,if(event_info['Title'] is null,event_info['title'],event_info['Title'])				
                ,server_time
)tta group by imei
	  ,model
	  ,app_version_name 
	  ,title
	  ,url
	  ,adid
             

参考链接:https://www.icode9.com/content-4-29405.html

相关标签: hive map