@Override public void reset(AggregationBuffer agg) throws HiveException { PercentileAggBuf result = (PercentileAggBuf) agg; result.histogram.reset(); result.quantiles = null; result.histogram.allocate(nbins); result.quantiles = quantiles; } }
@Override public void reset(AggregationBuffer agg) throws HiveException { PercentileAggBuf result = (PercentileAggBuf) agg; result.histogram.reset(); result.quantiles = null; result.histogram.allocate(nbins); result.quantiles = quantiles; } }
@Override public void iterate(AggregationBuffer agg, Object[] parameters) throws HiveException { assert (parameters.length == 2); if(parameters[0] == null || parameters[1] == null) { return; } StdAgg myagg = (StdAgg) agg; // Parse out the number of histogram bins only once, if we haven't already done // so before. We need at least 2 bins; otherwise, there is no point in creating // a histogram. if(!myagg.histogram.isReady()) { int nbins = PrimitiveObjectInspectorUtils.getInt(parameters[1], nbinsOI); if(nbins < 2) { throw new HiveException(getClass().getSimpleName() + " needs nbins to be at least 2," + " but you supplied " + nbins + "."); } // allocate memory for the histogram bins myagg.histogram.allocate(nbins); } // Process the current data point double v = PrimitiveObjectInspectorUtils.getDouble(parameters[0], inputOI); myagg.histogram.add(v); }
@Override public void iterate(AggregationBuffer agg, Object[] parameters) throws HiveException { assert (parameters.length == 2); if(parameters[0] == null || parameters[1] == null) { return; } StdAgg myagg = (StdAgg) agg; // Parse out the number of histogram bins only once, if we haven't already done // so before. We need at least 2 bins; otherwise, there is no point in creating // a histogram. if(!myagg.histogram.isReady()) { int nbins = PrimitiveObjectInspectorUtils.getInt(parameters[1], nbinsOI); if(nbins < 2) { throw new HiveException(getClass().getSimpleName() + " needs nbins to be at least 2," + " but you supplied " + nbins + "."); } // allocate memory for the histogram bins myagg.histogram.allocate(nbins); } // Process the current data point double v = PrimitiveObjectInspectorUtils.getDouble(parameters[0], inputOI); myagg.histogram.add(v); }
@Override public void reset(AggregationBuffer agg) throws HiveException { PercentileAggBuf result = (PercentileAggBuf) agg; result.histogram.reset(); result.quantiles = null; result.histogram.allocate(nbins); result.quantiles = quantiles; } }
@Override public void iterate(AggregationBuffer agg, Object[] parameters) throws HiveException { assert (parameters.length == 2); if(parameters[0] == null || parameters[1] == null) { return; } StdAgg myagg = (StdAgg) agg; // Parse out the number of histogram bins only once, if we haven't already done // so before. We need at least 2 bins; otherwise, there is no point in creating // a histogram. if(!myagg.histogram.isReady()) { int nbins = PrimitiveObjectInspectorUtils.getInt(parameters[1], nbinsOI); if(nbins < 2) { throw new HiveException(getClass().getSimpleName() + " needs nbins to be at least 2," + " but you supplied " + nbins + "."); } // allocate memory for the histogram bins myagg.histogram.allocate(nbins); } // Process the current data point double v = PrimitiveObjectInspectorUtils.getDouble(parameters[0], inputOI); myagg.histogram.add(v); }
@Override public void iterate(AggregationBuffer agg, Object[] parameters) throws HiveException { assert (parameters.length == 2); if(parameters[0] == null || parameters[1] == null) { return; } StdAgg myagg = (StdAgg) agg; // Parse out the number of histogram bins only once, if we haven't already done // so before. We need at least 2 bins; otherwise, there is no point in creating // a histogram. if(!myagg.histogram.isReady()) { int nbins = PrimitiveObjectInspectorUtils.getInt(parameters[1], nbinsOI); if(nbins < 2) { throw new HiveException(getClass().getSimpleName() + " needs nbins to be at least 2," + " but you supplied " + nbins + "."); } // allocate memory for the histogram bins myagg.histogram.allocate(nbins); } // Process the current data point double v = PrimitiveObjectInspectorUtils.getDouble(parameters[0], inputOI); myagg.histogram.add(v); }