Hadoop 通过计算特定字段的平均值,配置单元查询组

Hadoop 通过计算特定字段的平均值,配置单元查询组,hadoop,hive,Hadoop,Hive,伙计们,我们有以下数据,我们无法为相同的数据编写配置单元查询 CUSTOMER_NAME PRODUCT_NAME PRICE OCCURANCE ID customer1, product1, 20, 1 customer1, product2, 30, 2 customer1, product1, 25, 3 customer1, product1, 20, 1

伙计们,我们有以下数据,我们无法为相同的数据编写配置单元查询

   CUSTOMER_NAME PRODUCT_NAME PRICE OCCURANCE ID
   customer1,    product1,    20,       1
   customer1,    product2,    30,       2
   customer1,    product1,    25,       3
   customer1,    product1,    20,       1
   customer1,    product2,    20,       2
   customer1,    product2,    30,       2
现在我们预期的产量低于预期

基本上,我们希望客户和产品的平均价格

     First we need to average price at customer1,product1,occuranceID level.        

e.g. customer1,product1,20 (AVG is 20 for occurance 1), 1
     customer1,product1,25 (AVG is 25 for occurance 3) , 3

      Now once again we have to average based on count of occurance (we will remove occurance ID here)

      output will be given blow.

      customer1,product1,20+25/2


      How to write HIVE query for this ?

我一开始不知道如何写这个,也不会写任何东西,这会让你的输出有点混乱。你能用语言告诉我,你到底想要达到什么,我的意思是平均值(价格?——第一次和最后一次发生)??我已经修改了问题陈述,基本上我们需要取平均值或平均值。问题解决了@