Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

The query (rewritten for hive):

Code Block
sql
sql

select
  i_item_desc

...


  ,i_category

...


  ,i_class

...


  ,i_current_price

...


  ,i_item_id

...


  ,itemrevenue

...


  ,itemrevenue*100/sum(itemrevenue)

...

 over
    (partition by i_class) as revenueratio

...

from

     (select

...


from
  (select
     i_item_desc

...


     ,i_category

...


     ,i_class

...


     ,i_current_price

...


     ,i_item_id

...


     ,sum(ws_ext_sales_price) as

...

     from

        web_sales

...

 itemrevenue
   from
     web_sales
     join item on (web_sales.ws_item_sk = item.i_item_sk)

...


     join date_dim on (web_sales.ws_sold_date_sk = date_dim.d_date_sk)

...

     where

...


   where
     i_category in ('1', '2', '3')

...


     and year(d_date) = 2001 and month(d_date) =

...

     group by

...

 10
   group by
     i_item_id

...


     ,i_item_desc

...


     ,i_category

...


     ,i_class

...


     ,i_current_price) tmp

...


order

...

    i_category

...

 by
  i_category
  ,i_class

...


  ,i_item_id

...


  ,i_item_desc

...


  ,revenueratio;

Plan with TEZ

Stage 0:

Local Work: Generate hash table for date dim

...