@Override
    public void reset(AggregationBuffer agg) throws HiveException {
      ((LeadLagBuffer) agg).initialize(amt);
    }
abstract class for Lead &amp; lag UDAFs GenericUDAFLeadLag.
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFLeadLag.java