/** * {@inheritDoc} */ public long getN() { return sumOfLogs.getN(); }
/** * {@inheritDoc} */ public long getN() { return sumOfLogs.getN(); }
/** * {@inheritDoc} */ public long getN() { return sumOfLogs.getN(); }
/** * Each statistic will have the same amount of total values associated with it so we really just * need to find the first one and get the N value from it. * * @return The number of times increment was called, or 0 if never called. */ public long getTotal() { if (this.statistics.size() > 0) { return this.statistics.entrySet().iterator().next().getValue().getN(); } return 0; }
@Override public FieldValue evaluate(List<FieldValue> arguments){ StorelessUnivariateStatistic statistic = createStatistic(); DataType dataType = null; for(int i = 0; i < arguments.size(); i++){ FieldValue value = getOptionalArgument(arguments, i); // "Missing values in the input to an aggregate function are simply ignored" if(Objects.equals(FieldValues.MISSING_VALUE, value)){ continue; } statistic.increment((value.asNumber()).doubleValue()); if(dataType != null){ dataType = TypeUtil.getCommonDataType(dataType, value.getDataType()); } else { dataType = value.getDataType(); } } // "If all inputs are missing, then the result evaluates to a missing value" if(statistic.getN() == 0){ return FieldValues.MISSING_VALUE; } Double result = statistic.getResult(); return FieldValueUtil.create(getResultDataType(dataType), OpType.CONTINUOUS, result); }