如何从一包元组中提取出来?

时间:2016-11-16 15:42:16

标签: apache-pig

所以我在描述后的猪中有以下数据结构:

    --------------------------------------------------------------------------------------------------------------------------------------------------------
| summed_hours_and_miles_by_driver     | group:int     | :bag{:tuple(driver_name:chararray)}             | total_hours:long     | total_miles:long     | 
--------------------------------------------------------------------------------------------------------------------------------------------------------
|                                      | 27            | {(Mark Lochbihler), ..., (Mark Lochbihler)}     | 220                  | 11006                | 
--------------------------------------------------------------------------------------------------------------------------------------------------------

这个想法是驱动程序名称(Mark Lochbihler)在一个元组包中被多次复制。 我怎样才能将它限制为单个名称,如SQL中的DISTINCT?

1 个答案:

答案 0 :(得分:0)

使用Distinct,假设A是你的关系

<?xml version='1.0' encoding='UTF-8'?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">    
    <bean id="newUserEmail" class="demo.NewUserEmail">
        <property name="policyComponent" ref="policyComponent"/>
        <property name="nodeService" ref="nodeService"/>
        <property name="personService" ref="personService"/>
        <property name="passwordGenerator" ref="passwordGenerator"/>
        <property name="authenticationService" ref="authenticationService"/>
    </bean>
</beans>