[ 
https://issues.apache.org/jira/browse/HIVE-522?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12714300#action_12714300
 ] 

Zheng Shao edited comment on HIVE-522 at 5/28/09 10:28 PM:
-----------------------------------------------------------

Interface for GenericUDAF.

{code:java}
interface GenericUDAF {

  enum Mode {
    /** Partial: from original data to partial aggregation data: iterate() and 
terminatePartial() will be called */
    PARTIAL,
    /** Merge: from partial aggregation to full aggregation: merge() and 
terminate() will be called */
    MERGE,
    /** Full: from original data directly to full aggregation: merge() and 
terminate() will be called */
    FULL
  };

  /** Initialize the aggregation.
   *  @param m  The mode of aggregation.
   *  @param parameters  The ObjectInspector for the parameters:
   *    In PARTIAL and FULL mode, the parameters are original data;
   *    In MERGE mode, the parameters are just partial aggregations (in that 
case, the array will always have a single element).
   *  @return  The ObjectInspector for the return value.
   *    In PARTIAL mode, the ObjectInspector for the return value of 
terminatePartial() call;
   *    In MERGE and FULL mode, the ObjectInspector for the return value of 
terminate() call.
   */
  ObjectInspector init(Mode m, ObjectInspector[] parameters);

  /** Iterate through raw data.
   *  @param parameters  The objects of parameters.
   */
  void iterate(Object[] parameters);

  /** Get partial aggregation result.
   *  @return partial aggregation result.
   */
  Object terminatePartial();

  /** Merge with partial aggregation result.
   *  @param partial  The partial aggregation result.
   */
  void merge(Object partial);

  /** Get final aggregation result.
   *  @return final aggregation result.
   */
  Object terminate();

}

{code}



      was (Author: zshao):
    Interface for GenericUDAF.

{code:java}
interface GenericUDAF {

  enum {
    /** Partial: from original data to partial aggregation data: iterate() and 
terminatePartial() will be called */
    PARTIAL,
    /** Merge: from partial aggregation to full aggregation: merge() and 
terminate() will be called */
    MERGE,
    /** Full: from original data directly to full aggregation: merge() and 
terminate() will be called */
    FULL
  } Mode;

  /** Initialize the aggregation.
   *  @param m  The mode of aggregation.
   *  @param parameters  The ObjectInspector for the parameters:
   *    In PARTIAL and FULL mode, the parameters are original data;
   *    In MERGE mode, the parameters are just partial aggregations (in that 
case, the array will always have a single element).
   *  @return  The ObjectInspector for the return value.
   *    In PARTIAL mode, the ObjectInspector for the return value of 
terminatePartial() call;
   *    In MERGE and FULL mode, the ObjectInspector for the return value of 
terminate() call.
   */
  OI init(Mode m, ObjectInspector[] parameters);

  /** Iterate through raw data.
   *  @param parameters  The objects of parameters.
   */
  void iterate(Object[] parameters);

  /** Get partial aggregation result.
   *  @return partial aggregation result.
   */
  Object terminatePartial();

  /** Merge with partial aggregation result.
   *  @param partial  The partial aggregation result.
   */
  void merge(Object partial);

  /** Get final aggregation result.
   *  @return final aggregation result.
   */
  Object terminate();

};

{code}


  
> GenericUDAF: Extend UDAF to deal with complex types
> ---------------------------------------------------
>
>                 Key: HIVE-522
>                 URL: https://issues.apache.org/jira/browse/HIVE-522
>             Project: Hadoop Hive
>          Issue Type: New Feature
>          Components: Query Processor
>    Affects Versions: 0.4.0
>            Reporter: Zheng Shao
>            Assignee: Zheng Shao
>
> We can pass arbitrary arguments into GenericUDFs. We should do the same thing 
> to GenericUDAF so that UDAF can also take arbitrary arguments.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to