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