title: Hive using sum() over function error--Failed to breakup Windowing invocations into Groups
body: <p>I'm trying to run this query which includes <code>sum(...) over(...)</code> function in Hive but shows error.
  And I'm trying to use <code>select distinct</code> in a subquery, but it still doesn't work.</p>
  
  <p>Is there an error in <code>join</code> function?</p>
  
  <p>This is my SQL code</p>
  
  <pre><code>    select
  c.driver_city_name,
  c.driver_car_brand,
  c.year,
  count(distinct c.driver_id)over(PARTITION BY c.driver_car_brand,c.driver_city_name,c.year),
  sum(c.upply_hr)over(PARTITION BY c.driver_car_brand,c.driver_city_name,c.year),
  sum(c.work_hr)over(PARTITION BY c.driver_car_brand,c.driver_city_name,c.year)
  from (
      select
      a.driver_city_name,
      a.driver_car_brand,
      a.driver_id,
      year(b.reg_date_cheling) as year,
      d.onlinetime as supply_hr,
      d.charge_time_length/60/60 as work_hr
      from gulfstream_dw.dw_v_driver_base a
      join (
          select 
          driver_id,
          reg_date_cheling
          from g_bi.t_brx_xinzheng_driver_diaodu_1
          where driver_city_id in (17,18,2,3,1,5,10,4,24,23)
          and concat_ws('-',year,month,day) BETWEEN '2016-11-19' and '2017-02-21'
      ) b on a.driver_id = b.driver_id
      join (
          select
          e.driver_id,
          sum(e.onlinetime) as onlinetime, --在线时长（单位：小时）
          sum(e.charge_time_length) as charge_time_length --计费总时长（单位：秒）
          from(
              select distinct
              concat_ws('-',year,month,day) date1,
              driver_id,
              onlinetime, --在线时长（单位：小时）
              charge_time_length --计费总时长（单位：秒）
              from gulfstream_dw.dw_m_driver_strategy
              where concat_ws('-',year,month,day) between '2016-11-19' and '2017-02-21'
              and onlinetime &gt; 0
           ) e
           group by e.driver_id
      ) d on a.driver_id = d.driver_id
      where driver_city_id in (17,18,2,3,1,5,10,4,24,23)
      and to_date(max_success_strive_time) BETWEEN '2016-11-20' and '2017-02-20' 
      and concat_ws('-',year,month,day) BETWEEN '2016-11-19' and '2017-02-21'
      and a.driver_car_brand in (
      "奇瑞-E3",
      "吉利-远景",
      )
      group by a.driver_city_name,a.driver_car_brand,a.driver_id,year(b.reg_date_cheling),d.onlinetime,d.charge_time_length/60/60
  )c
  
  group by c.driver_city_name,c.driver_car_brand,c.year
  </code></pre>
  
  <p>But there is error:</p>
  
  <blockquote>
    <p>ERROR Type:SEMANTIC_FAILED Error while compiling statement: FAILED:
    SemanticException Failed to breakup Windowing invocations into Groups.
    At least 1 group must only depend on input columns. Also check for
    circular dependencies. Underlying error:
    org.apache.hadoop.hive.ql.parse.SemanticException: Line 6:6 Invalid
    column reference 'supply_hr'</p>
  </blockquote>
  
  <p>If I leave out <code>sum over</code> function and just keep <code>count over</code> function, it runs successfully.</p>