sparksql报错 cannot resolve 'coalesce(d.`field`, map(NULL, NULL))' due to data type mismatch: input to function coalesce should all be the same type
hivesql可运行的sql 在spark上运行报错如下
Error in query: cannot resolve 'coalesce(d.`subarea_duration_l30`, map(NULL, NULL))' due to data type mismatch: input to function coalesce should all be the same type, but it's [map<string,string>, map<null,null>]; line 17 pos 2;
hivesql语句部分如下
NVL(subarea_num_l30, 0) subarea_num_l30, NVL(subarea_duration_l30, MAP(null, null)) subarea_duration_l30, NVL(anchor_num_l30, 0) achor_num_l30, NVL(day_num_l30, 0) day_num_l30, NVL(avg_hour_duration_l30, MAP(null, null)) avg_hour_duration_l30, NVL(watch_count_l90, 0) watch_count_l90, NVL(watch_duration_l90, 0) watch_duration_l90, IF( NVL(watch_count_l90, 0) = 0,
解决方法:
将Map(null,null)改为Map()即可