简体   繁体   中英

While I try to use Partition over Hive,

SELECT
    prc.user_key,
    percentile(P.price, 0.5) OVER (PARTITION BY P.user_key) as median_price       
    FROM
    (
     SELECT 
     vfc.user_key,
     vfc.order_id,
     MIN(vddo.cc)  price
     FROM
     td_b.mv_a vfc
     JOIN
     td_b.dim_deal_option vddo
     ON vfc.d_key = vddo.d_key
     WHERE
     vfc.action = 'sale'
     GROUP BY  vfc.user_key, vfc.order_id
    ) prc limit 100;

Gives the error "FAILED: Parse Error: line 4:13 mismatched input '(' expecting FROM near 'OVER' in from clause" in Hive. When i remove the percentile and partition query works fine, any idea? I tried count() instead of percentile, still the same error.

the percentile / partition line aliases the subquery with "P" (P.price and P.user_key) but the subquery is "prc". Sometimes bad aliases will throw that error

P.Price和P.user_key不存在。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM