UDAF code template

In this section, we introduce the UDAF code template, which extends from the org.apache.hadoop.hive.ql.exec.UDAF class. The code template is as follows:

package com.packtpub.hive.essentials.hiveudaf;

import org.apache.hadoop.hive.ql.exec.UDAF;
import org.apache.hadoop.hive.ql.exec.UDAFEvaluator;
import org.apache.hadoop.hive.ql.exec.Description;
import org.apache.hadoop.hive.ql.udf.UDFType;

@Description(
 name = "udaf_name",
 value = "_FUNC_(arg1, arg2, ... argN) - description for the function",
 extended = "description with more details, such as syntax, examples."
)
@UDFType(deterministic = false, stateful = true)

public final class udaf_name extends UDAF {
  /**
   * The internal state of an aggregation function.
   *
   * Note that ...

Get Apache Hive Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.