예제 #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();
 }
예제 #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;
   }
 }
예제 #3
0
파일: LikeEval.java 프로젝트: niumowm/tajo
 @Override
 public void eval(EvalContext ctx, Schema schema, Tuple tuple) {
   if (fieldId == null) {
     fieldId = schema.getColumnId(column.getQualifiedName());
     compile(this.pattern);
   }
   StringDatum str = tuple.getString(fieldId);
   if (not) {
     result.setValue(!compiled.matcher(str.asChars()).matches());
   } else {
     result.setValue(compiled.matcher(str.asChars()).matches());
   }
 }
예제 #4
0
 @Override
 public void eval(FunctionContext ctx, Tuple params) {
   MinContext minCtx = (MinContext) ctx;
   minCtx.min = Math.min(minCtx.min, params.get(0).asInt());
 }
예제 #5
0
 @Override
 public void eval(FunctionContext ctx, Tuple params) {
   AvgContext avgCtx = (AvgContext) ctx;
   avgCtx.sum += params.get(0).asDouble();
   avgCtx.count++;
 }