@Override
 public void merge(AggregationBuffer agg, Object partial) throws HiveException {
   MkArrayAggregationBuffer myagg = (MkArrayAggregationBuffer) agg;
   ArrayList<Object> partialResult = (ArrayList<Object>) internalMergeOI.getList(partial);
   for (Object i : partialResult) {
     putIntoSet(i, myagg);
   }
 }
    @Override
    public void merge(AggregationBuffer agg, Object partial) throws HiveException {
      DeleteBuffer myagg = (DeleteBuffer) agg;
      List<Object> partialResult = (List<Object>) this.listKVOI.getList(partial);
      ListObjectInspector subListOI =
          (ListObjectInspector) listKVOI.getListElementObjectInspector();

      List first = subListOI.getList(partialResult.get(0));
      String tableName =
          ((StringObjectInspector) (subListOI.getListElementObjectInspector()))
              .getPrimitiveJavaObject(first.get(0));
      configMap.put(HTableFactory.TABLE_NAME_TAG, tableName);
      String zookeeper =
          ((StringObjectInspector) (subListOI.getListElementObjectInspector()))
              .getPrimitiveJavaObject(first.get(1));
      configMap.put(HTableFactory.ZOOKEEPER_QUORUM_TAG, zookeeper);

      //// Include arbitrary configurations, by adding strings of the form k=v
      for (int j = 4; j < first.size(); ++j) {
        String kvStr =
            ((StringObjectInspector) (subListOI.getListElementObjectInspector()))
                .getPrimitiveJavaObject(first.get(j));
        String[] kvArr = kvStr.split("=");
        if (kvArr.length == 2) {
          configMap.put(kvArr[0], kvArr[1]);
        }
      }

      for (int i = 1; i < partialResult.size(); ++i) {

        List kvList = subListOI.getList(partialResult.get(i));
        String key =
            ((StringObjectInspector) (subListOI.getListElementObjectInspector()))
                .getPrimitiveJavaObject(kvList.get(0));

        myagg.addKey(key.getBytes());
      }

      if (myagg.deleteList.size() >= batchSize) {
        batchUpdate(myagg, false);
      }
    }
 public ObjectInspector init(Mode m, ObjectInspector[] parameters) throws HiveException {
   super.init(m, parameters);
   if (m == Mode.PARTIAL1) {
     inputOI = (PrimitiveObjectInspector) parameters[0];
     return ObjectInspectorFactory.getStandardListObjectInspector(
         (PrimitiveObjectInspector) ObjectInspectorUtils.getStandardObjectInspector(inputOI));
   } else {
     if (!(parameters[0] instanceof StandardListObjectInspector)) {
       inputOI =
           (PrimitiveObjectInspector)
               ObjectInspectorUtils.getStandardObjectInspector(parameters[0]);
       return (StandardListObjectInspector)
           ObjectInspectorFactory.getStandardListObjectInspector(inputOI);
     } else {
       internalMergeOI = (StandardListObjectInspector) parameters[0];
       inputOI = (PrimitiveObjectInspector) internalMergeOI.getListElementObjectInspector();
       loi =
           (StandardListObjectInspector)
               ObjectInspectorUtils.getStandardObjectInspector(internalMergeOI);
       return loi;
     }
   }
 }