Example #1
0
 @Override
 public void merge(FunctionContext ctx, Tuple part) {
   AvgContext avgCtx = (AvgContext) ctx;
   ArrayDatum array = (ArrayDatum) part.get(0);
   avgCtx.sum += array.get(0).asDouble();
   avgCtx.count += array.get(1).asLong();
 }
Example #2
0
 @Override
 public Datum eval(Tuple params) {
   try {
     return DatumFactory.createInt8(
         new SimpleDateFormat(dateFormat).parse(params.get(0).asChars()).getTime());
   } catch (ParseException e) {
     LOG.error(e);
     return null;
   }
 }
Example #3
0
 @Override
 public void eval(FunctionContext ctx, Tuple params) {
   MinContext minCtx = (MinContext) ctx;
   minCtx.min = Math.min(minCtx.min, params.get(0).asInt());
 }
Example #4
0
 @Override
 public void eval(FunctionContext ctx, Tuple params) {
   AvgContext avgCtx = (AvgContext) ctx;
   avgCtx.sum += params.get(0).asDouble();
   avgCtx.count++;
 }