示例#1
0
 @Override
 public void merge(AggregationBuffer agg, Object partial) throws HiveException {
   if (partial != null) {
     SumDoubleAgg myagg = (SumDoubleAgg) agg;
     myagg.empty = false;
     if (isWindowingDistinct()) {
       throw new HiveException(
           "Distinct windowing UDAF doesn't support merge and terminatePartial");
     } else {
       myagg.sum += PrimitiveObjectInspectorUtils.getDouble(partial, inputOI);
     }
   }
 }
示例#2
0
 @Override
 public void iterate(AggregationBuffer agg, Object[] parameters) throws HiveException {
   assert (parameters.length == 1);
   try {
     if (isEligibleValue((SumDoubleAgg) agg, parameters[0])) {
       ((SumDoubleAgg) agg).empty = false;
       ((SumDoubleAgg) agg).sum +=
           PrimitiveObjectInspectorUtils.getDouble(parameters[0], inputOI);
     }
   } catch (NumberFormatException e) {
     if (!warned) {
       warned = true;
       LOG.warn(getClass().getSimpleName() + " " + StringUtils.stringifyException(e));
       LOG.warn(getClass().getSimpleName() + " ignoring similar exceptions.");
     }
   }
 }