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()即可

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM