Aggregation functions demoΒΆ

dual(1000)                                  //use the dual() generator as the data source, get 1000 rows
 .select(
    i % 5 as group_f,                       //derive the field value for grouping from the integer field 'i'
    i * 0.11 as value_f)                    //derive value for the aggregation function
 .select(
   group_f,
   MIN(value_f) as min,                     //min function finds the minimum in the set
   MAX(value_f) as max,                     //max function finds the maximum in the set
   SUM(value_f) as sum,                     //arithmetic sum
   COUNT(*) as cnt1,                        //computes the count of rows
   COUNT(value_f > 2.0) as cntConditional,  //computes a conditional count
   AVG(value_f) as avg,                     //computes the arithmetic mean (average)
   CORR(value_f, value_f+1) as corr,        //computes the Pearson correlation coefficient
   STDDEV(value_f) as stddev,               //computes the estimation of standard deviation from samples
   STDDEV_POP(value_f) as stddev_pop,       //computes the standard deviation for a population
   VARIANCE(value_f) as variance,           //computes the estimation of variance from samples (alias to VAR_SAMP)
   VAR_POP(value_f) as var_pop              //computes the variance for a population
 )
 .group(group_f)
group_f min max sum cnt1 cntConditional avg corr stddev stddev_pop variance var_pop
0 0.0 109.45 10945.000000000002 200 196 54.72500000000001 0.9999999999999999 31.833551482673187 31.753867874638583 1013.3750000000042 1008.3081250000042
1 0.11 109.56 10966.999999999998 200 196 54.834999999999994 1.0 31.83355148267319 31.753867874638583 1013.3750000000044 1008.3081250000043
2 0.22 109.67 10989.000000000005 200 196 54.94500000000003 1.0 31.83355148267319 31.753867874638587 1013.3750000000045 1008.3081250000046
3 0.33 109.78 11010.999999999995 200 196 55.05499999999997 1.0 31.83355148267319 31.753867874638587 1013.3750000000045 1008.3081250000046
4 0.44 109.89 11033.0 200 197 55.165 1.0 31.833551482673183 31.753867874638576 1013.375000000004 1008.3081250000039