Exemplo n.º 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();
 }
Exemplo n.º 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;
   }
 }
Exemplo n.º 3
0
 @Override
 public void eval(FunctionContext ctx, Tuple params) {
   MinContext minCtx = (MinContext) ctx;
   minCtx.min = Math.min(minCtx.min, params.get(0).asInt());
 }
Exemplo n.º 4
0
 @Override
 public void eval(FunctionContext ctx, Tuple params) {
   AvgContext avgCtx = (AvgContext) ctx;
   avgCtx.sum += params.get(0).asDouble();
   avgCtx.count++;
 }