UDAF writing

Create a class to store objects
create object
The methods that UDAF needs to call:
    init     HIVE will call this method to initially instantiate a UDAF evaluator class    
     iterate      loads a new line of data into the aggregate buffer (initializes the data)


 
     terminatePartial      returns the current aggregate content in a sustainable way. (The return value can only use Java basic data and array, as well as basic encapsulation types (such as Double), Writeable class, list and map type in Hadoop. User-defined classes cannot be used (even if Java.io.serializable is implemented) I I think it is the middle key of map a#b#c


 
     merge      merges the intermediate partial aggregation results returned by terminatePartial into the current aggregation


 
     terminate      returns the final aggregation result to hive (reduce)


 
The running process of UDAF


 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326115777&siteId=291194637