Oracle CQL provides a set of built-in aggregate functions based on the Colt open source libraries for high performance scientific and technical computing.
For more information, see Section 1.1.9, "Functions".
Table 8-1 lists the built-in aggregate Colt functions that Oracle CQL provides.
Table 8-1 Oracle CQL Built-in Aggregate Colt-Based Functions
| Colt Package | Function |
|---|---|
|
A set of basic descriptive statistics functions. |
|
Note:
Built-in function names are case sensitive and you must use them in the case shown (in lower case).Note:
In stream input examples, lines beginning withh (such as h 3800) are heartbeat input tuples. These inform Oracle CEP that no further input will have a timestamp lesser than the heartbeat value.
In relation output examples, the first tuple output is:
-9223372036854775808:+
This value is -Long.MIN_VALUE() and represents the largest negative timestamp possible.
For more information, see:
Note that the signatures of the Oracle CQL Colt aggregate functions do not match the signatures of the corresponding Colt aggregate functions.
Consider the following Colt aggregate function:
double autocorrelation(DoubleArrayList data, int lag, double mean, double variance)
In this signature, data is the Collection over which aggregates will be calculated and mean and variance are the other two parameter aggregates which are required to calculate autoCorrelation (where mean and variance aggregates are calculated on data).
In Oracle CEP, data will never come in the form of a Collection. The Oracle CQL function receives input data in a stream of tuples.
So suppose our stream is defined as S:(double val, integer lag). On each input tuple, the Oracle CQL autocorrelation function will compute two intermediate aggregates, mean and variance, and one final aggregate, autocorrelation.
Since the function expects a stream of tuples having a double data value and an integer lag value only, the signature of the Oracle CQL autocorrelation function is:
double autocorrelation (double data, int lag)
autocorrelation is based on cern.jet.stat.Descriptive.autoCorrelation(DoubleArrayList data, int lag, double mean, double variance). It returns the auto-correlation of a data sequence of the input arguments as a double.
Note:
This function has semantics different from "lag1"This function takes the following tuple arguments:
double1: data value.
int1: lag.
For more information, see
Consider the query qColtAggr1 in Example 8-1. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-2, the query returns the relation in Example 8-3.
Example 8-1 autocorrelation Function Query
<query id="qColtAggr1"><![CDATA[
select autocorrelation(c3, c1) from SColtAggrFunc
]]></query>
correlation is based on cern.jet.stat.Descriptive.correlation(DoubleArrayList data1, double standardDev1, DoubleArrayList data2, double standardDev2) . It returns the correlation of two data sequences of the input arguments as a double.
This function takes the following tuple arguments:
double1: data value 1.
double2: data value 2.
For more information, see
Consider the query qColtAggr2 in Example 8-4. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-5, the query returns the relation in Example 8-6.
Example 8-4 correlation Function Query
<query id="qColtAggr2"><![CDATA[
select correlation(c3, c3) from SColtAggrFunc
]]></query>
covariance is based on cern.jet.stat.Descriptive.covariance(DoubleArrayList data1, DoubleArrayList data2). It returns the correlation of two data sequences (see Figure 8-1) of the input arguments as a double.
This function takes the following tuple arguments:
double1: data value 1.
double2: data value 2.
For more information, see:
Consider the query qColtAggr3 in Example 8-7. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-8, the query returns the relation in Example 8-9.
Example 8-7 covariance Function Query
<query id="qColtAggr3"><![CDATA[
select covariance(c3, c3) from SColtAggrFunc
]]></query>
geometricmean is based on cern.jet.stat.Descriptive.geometricMean(DoubleArrayList data). It returns the geometric mean of a data sequence (see Figure 8-2) of the input argument as a double.
This function takes the following tuple arguments:
double1: data value.
Note that for a geometric mean to be meaningful, the minimum of the data values must not be less than or equal to zero.
For more information, see:
Consider the query qColtAggr6 in Example 8-10. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-11, the query returns the relation in Example 8-12.
Example 8-10 geometricmean Function Query
<query id="qColtAggr6"><![CDATA[
select geometricmean(c3) from SColtAggrFunc
]]></query>
geometricmean1 is based on cern.jet.stat.Descriptive.geometricMean(double sumOfLogarithms). It returns the geometric mean of a data sequence (see Figure 8-3) of the input arguments as a double.
This function takes the following tuple arguments:
double1: data value.
For more information, see:
Consider the query qColtAggr7 in Example 8-13. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-14, the query returns the relation in Example 8-15.
Example 8-13 geometricmean1 Function Query
<query id="qColtAggr7"><![CDATA[
select geometricmean1(c3) from SColtAggrFunc
]]></query>
harmonicmean is based on cern.jet.stat.Descriptive.harmonicMean(int size, double sumOfInversions). It returns the harmonic mean of a data sequence as a double.
This function takes the following tuple arguments:
double1: data value.
For more information, see:
http://acs.lbl.gov/~hoschek/colt/api/cern/jet/stat/Descriptive.html#harmonicMean(int,%20double)
Section 8.1.1, "Oracle CQL Colt Aggregate Function Signatures and Tuple Arguments"
Consider the query qColtAggr8 in Example 8-16. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-17, the query returns the relation in Example 8-18.
Example 8-16 harmonicmean Function Query
<query id="qColtAggr8"><![CDATA[
select harmonicmean(c3) from SColtAggrFunc
]]></query>
kurtosis is based on cern.jet.stat.Descriptive.kurtosis(DoubleArrayList data, double mean, double standardDeviation). It returns the kurtosis or excess (see Figure 8-4) of a data sequence as a double.
Figure 8-4 cern.jet.stat.Descriptive.kurtosis(DoubleArrayList data, double mean, double standardDeviation)

This function takes the following tuple arguments:
double1: data value.
For more information, see
Consider the query qColtAggr12 in Example 8-19. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-20, the query returns the relation in Example 8-21.
Example 8-19 kurtosis Function Query
<query id="qColtAggr12"><![CDATA[
select kurtosis(c3) from SColtAggrFunc
]]></query>
lag1 is based on cern.jet.stat.Descriptive.lag1(DoubleArrayList data, double mean). It returns the lag - 1 auto-correlation of a dataset as a double.
Note:
This function has semantics different from "autocorrelation".This function takes the following tuple arguments:
double1: data value.
For more information, see
Consider the query qColtAggr14 in Example 8-22. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-23, the query returns the relation in Example 8-24.
Example 8-22 lag1 Function Query
<query id="qColtAggr14"><![CDATA[
select lag1(c3) from SColtAggrFunc
]]></query>
mean is based on cern.jet.stat.Descriptive.mean(DoubleArrayList data). It returns the arithmetic mean of a data sequence (see Figure 8-5) as a double.
This function takes the following tuple arguments:
double1: data value.
For more information, see:
Consider the query qColtAggr16 in Example 8-25. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-26, the query returns the relation in Example 8-27.
Example 8-25 mean Function Query
<query id="qColtAggr16"><![CDATA[
select mean(c3) from SColtAggrFunc
]]></query>
meandeviation is based on cern.jet.stat.Descriptive.meanDeviation(DoubleArrayList data, double mean). It returns the mean deviation of a dataset (see Figure 8-6) as a double.
This function takes the following tuple arguments:
double1: data value.
For more information, see
Consider the query qColtAggr17 in Example 8-28. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-29, the query returns the relation in Example 8-30.
Example 8-28 meandeviation Function Query
<query id="qColtAggr17"><![CDATA[
select meandeviation(c3) from SColtAggrFunc
]]></query>
median is based on cern.jet.stat.Descriptive.median(DoubleArrayList sortedData). It returns the median of a sorted data sequence as a double.
This function takes the following tuple arguments:
double1: data value.
For more information, see:
Consider the query qColtAggr18 in Example 8-31. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-32, the query returns the relation in Example 8-33.
Example 8-31 median Function Query
<query id="qColtAggr18"><![CDATA[
select median(c3) from SColtAggrFunc
]]></query>
moment is based on cern.jet.stat.Descriptive.moment(DoubleArrayList data, int k, double c). It returns the moment of the k-th order with constant c of a data sequence (see Figure 8-7) as a double.
This function takes the following tuple arguments:
double1: data value.
int1: k.
double2: c.
For more information, see:
Consider the query qColtAggr21 in Example 8-34. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-35, the query returns the relation in Example 8-36.
Example 8-34 moment Function Query
<query id="qColtAggr21"><![CDATA[
select moment(c3, c1, c3) from SColtAggrFunc
]]></query>
pooledmean is based on cern.jet.stat.Descriptive.pooledMean(int size1, double mean1, int size2, double mean2). It returns the pooled mean of two data sequences (see Figure 8-8) as a double.
This function takes the following tuple arguments:
double1: mean 1.
double2: mean 2.
For more information, see
Consider the query qColtAggr22 in Example 8-37. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-38, the query returns the relation in Example 8-39.
Example 8-37 pooledmean Function Query
<query id="qColtAggr22"><![CDATA[
select pooledmean(c3, c3) from SColtAggrFunc
]]></query>
pooledvariance is based on cern.jet.stat.Descriptive.pooledVariance(int size1, double variance1, int size2, double variance2). It returns the pooled variance of two data sequences (see Figure 8-9) as a double.
Figure 8-9 cern.jet.stat.Descriptive.pooledVariance(int size1, double variance1, int size2, double variance2)

This function takes the following tuple arguments:
double1: variance 1.
double2: variance 2.
For more information, see
Consider the query qColtAggr23 in Example 8-40. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-41, the query returns the relation in Example 8-42.
Example 8-40 pooledvariance Function Query
<query id="qColtAggr23"><![CDATA[
select pooledvariance(c3, c3) from SColtAggrFunc
]]></query>
product is based on cern.jet.stat.Descriptive.product(DoubleArrayList data). It returns the product of a data sequence (see Figure 8-10) as a double.
This function takes the following tuple arguments:
double1: data value.
For more information, see:
Consider the query qColtAggr24 in Example 8-43. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-44, the query returns the relation in Example 8-45.
Example 8-43 product Function Query
<query id="qColtAggr24"><![CDATA[
select product(c3) from SColtAggrFunc
]]></query>
quantile is based on cern.jet.stat.Descriptive.quantile(DoubleArrayList sortedData, double phi). It returns the phi-quantile as a double; that is, an element elem for which holds that phi percent of data elements are less than elem.
This function takes the following tuple arguments:
double1: data value.
double2: phi; the percentage; must satisfy 0 <= phi <= 1.
For more information, see:
Consider the query qColtAggr26 in Example 8-46. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-47, the query returns the relation in Example 8-48.
Example 8-46 quantile Function Query
<query id="qColtAggr26"><![CDATA[
select quantile(c3, c2) from SColtAggrFunc
]]></query>
quantileinverse is based on cern.jet.stat.Descriptive.quantileInverse(DoubleArrayList sortedList, double element). It returns the percentage phi of elements <= element (0.0 <= phi <= 1.0) as a double. This function does linear interpolation if the element is not contained but lies in between two contained elements.
This function takes the following tuple arguments:
double1: data.
double2: element.
For more information, see:
Consider the query qColtAggr27 in Example 8-49. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-50, the query returns the relation in Example 8-51.
Example 8-49 quantileinverse Function Query
<query id="qColtAggr27"><![CDATA[
select quantileinverse(c3, c3) from SColtAggrFunc
]]></query>
rankinterpolated is based on cern.jet.stat.Descriptive.rankInterpolated(DoubleArrayList sortedList, double element). It returns the linearly interpolated number of elements in a list less or equal to a given element as a double.
The rank is the number of elements <= element. Ranks are of the form{0, 1, 2,..., sortedList.size()}. If no element is <= element, then the rank is zero. If the element lies in between two contained elements, then linear interpolation is used and a non-integer value is returned.
This function takes the following tuple arguments:
double1: data value.
double2: element.
For more information, see:
Consider the query qColtAggr29 in Example 8-52. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-53, the query returns the relation in Example 8-54.
Example 8-52 rankinterpolated Function Query
<query id="qColtAggr29"><![CDATA[
select rankinterpolated(c3, c3) from SColtAggrFunc
]]></query>
rms is based on cern.jet.stat.Descriptive.rms(int size, double sumOfSquares). It returns the Root-Mean-Square (RMS) of a data sequence (see Figure 8-11) as a double.
This function takes the following tuple arguments:
double1: data value.
For more information, see
http://acs.lbl.gov/~hoschek/colt/api/cern/jet/stat/Descriptive.html#rms(int,%20double)
Section 8.1.1, "Oracle CQL Colt Aggregate Function Signatures and Tuple Arguments"
Consider the query qColtAggr30 in Example 8-55. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-56, the query returns the relation in Example 8-57.
Example 8-55 rms Function Query
<query id="qColtAggr30"><![CDATA[
select rms(c3) from SColtAggrFunc
]]></query>
samplekurtosis is based on cern.jet.stat.Descriptive.sampleKurtosis(DoubleArrayList data, double mean, double sampleVariance). It returns the sample kurtosis (excess) of a data sequence as a double.
This function takes the following tuple arguments:
double1: data value.
For more information, see:
Consider the query qColtAggr31 in Example 8-58. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-59, the query returns the relation in Example 8-60.
Example 8-58 samplekurtosis Function Query
<query id="qColtAggr31"><![CDATA[
select samplekurtosis(c3) from SColtAggrFunc
]]></query>
samplekurtosisstandarderror is based on cern.jet.stat.Descriptive.sampleKurtosisStandardError(int size). It returns the standard error of the sample Kurtosis as a double.
This function takes the following tuple arguments:
int1: data value.
For more information, see:
http://acs.lbl.gov/~hoschek/colt/api/cern/jet/stat/Descriptive.html#sampleKurtosisStandardError(int)
Section 8.1.1, "Oracle CQL Colt Aggregate Function Signatures and Tuple Arguments"
Consider the query qColtAggr33 in Example 8-61. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-62, the query returns the relation in Example 8-63.
Example 8-61 samplekurtosisstandarderror Function Query
<query id="qColtAggr33"><![CDATA[
select samplekurtosisstandarderror(c1) from SColtAggrFunc
]]></query>
sampleskew is based on cern.jet.stat.Descriptive.sampleSkew(DoubleArrayList data, double mean, double sampleVariance). It returns the sample skew of a data sequence as a double.
This function takes the following tuple arguments:
double1: data value.
For more information, see:
Consider the query qColtAggr34 in Example 8-64. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-65, the query returns the relation in Example 8-66.
Example 8-64 sampleskew Function Query
<query id="qColtAggr34"><![CDATA[
select sampleskew(c3) from SColtAggrFunc
]]></query>
sampleskewstandarderror is based on cern.jet.stat.Descriptive.sampleSkewStandardError(int size). It returns the standard error of the sample skew as a double.
This function takes the following tuple arguments:
double1: data value.
For more information, see:
http://acs.lbl.gov/~hoschek/colt/api/cern/jet/stat/Descriptive.html#sampleSkewStandardError(int)
Section 8.1.1, "Oracle CQL Colt Aggregate Function Signatures and Tuple Arguments"
Consider the query qColtAggr36 in Example 8-67. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-68, the query returns the relation in Example 8-69.
Example 8-67 sampleskewstandarderror Function Query
<query id="qColtAggr36"><![CDATA[
select sampleskewstandarderror(c1) from SColtAggrFunc
]]></query>
samplevariance is based on cern.jet.stat.Descriptive.sampleVariance(DoubleArrayList data, double mean). It returns the sample variance of a data sequence (see Figure 8-12) as a double.
This function takes the following tuple arguments:
double1: data value.
For more information, see:
Consider the query qColtAggr38 in Example 8-70. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-71, the query returns the relation in Example 8-72.
Example 8-70 samplevariance Function Query
<query id="qColtAggr38"><![CDATA[
select samplevariance(c3) from SColtAggrFunc
]]></query>
skew is based on cern.jet.stat.Descriptive.skew(DoubleArrayList data, double mean, double standardDeviation). It returns the skew of a data sequence of a data sequence (see Figure 8-13) as a double.
Figure 8-13 cern.jet.stat.Descriptive.skew(DoubleArrayList data, double mean, double standardDeviation)

This function takes the following tuple arguments:
double1: data value.
For more information, see:
Consider the query qColtAggr41 in Example 8-73. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-74, the query returns the relation in Example 8-75.
Example 8-73 skew Function Query
<query id="qColtAggr41"><![CDATA[
select skew(c3) from SColtAggrFunc
]]></query>
standarddeviation is based on cern.jet.stat.Descriptive.standardDeviation(double variance). It returns the standard deviation from a variance as a double.
This function takes the following tuple arguments:
double1: data value.
For more information, see
http://acs.lbl.gov/~hoschek/colt/api/cern/jet/stat/Descriptive.html#standardDeviation(double)
Section 8.1.1, "Oracle CQL Colt Aggregate Function Signatures and Tuple Arguments"
Consider the query qColtAggr44 in Example 8-76. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-77, the query returns the relation in Example 8-78.
Example 8-76 standarddeviation Function Query
<query id="qColtAggr44"><![CDATA[
select standarddeviation(c3) from SColtAggrFunc
]]></query>
standarderror is based on cern.jet.stat.Descriptive.standardError(int size, double variance). It returns the standard error of a data sequence (see Figure 8-14) as a double.
Figure 8-14 cern.jet.stat.Descriptive.cern.jet.stat.Descriptive.standardError(int size, double variance)

This function takes the following tuple arguments:
double1: data value.
For more information, see
http://acs.lbl.gov/~hoschek/colt/api/cern/jet/stat/Descriptive.html#standardError(int,%20double)
Section 8.1.1, "Oracle CQL Colt Aggregate Function Signatures and Tuple Arguments"
Consider the query qColtAggr45 in Example 8-79. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-80, the query returns the relation in Example 8-81.
Example 8-79 standarderror Function Query
<query id="qColtAggr45"><![CDATA[
select standarderror(c3) from SColtAggrFunc
]]></query>
sumofinversions is based on cern.jet.stat.Descriptive.sumOfInversions(DoubleArrayList data, int from, int to). It returns the sum of inversions of a data sequence (see Figure 8-15) as a double.
This function takes the following tuple arguments:
double1: data value.
For more information, see:
Consider the query qColtAggr48 in Example 8-82. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-83, the query returns the relation in Example 8-84.
Example 8-82 sumofinversions Function Query
<query id="qColtAggr48"><![CDATA[
select sumofinversions(c3) from SColtAggrFunc
]]></query>
sumoflogarithms is based on cern.jet.stat.Descriptive.sumOfLogarithms(DoubleArrayList data, int from, int to). It returns the sum of logarithms of a data sequence (see Figure 8-16) as a double.
This function takes the following tuple arguments:
double1: data value.
For more information, see:
Consider the query qColtAggr49 in Example 8-85. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-86, the query returns the relation in Example 8-87.
Example 8-85 sumoflogarithms Function Query
<query id="qColtAggr49"><![CDATA[
select sumoflogarithms(c3) from SColtAggrFunc
]]></query>
sumofpowerdeviations is based on cern.jet.stat.Descriptive.sumOfPowerDeviations(DoubleArrayList data, int k, double c). It returns sum of power deviations of a data sequence (see Figure 8-17) as a double.
This function is optimized for common parameters like c == 0.0, k == -2 .. 4, or both.
This function takes the following tuple arguments:
double1: data value.
int1: k.
double2: c.
For more information, see:
Consider the query qColtAggr50 in Example 8-88. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-89, the query returns the relation in Example 8-90.
Example 8-88 sumofpowerdeviations Function Query
<query id="qColtAggr50"><![CDATA[
select sumofpowerdeviations(c3, c1, c3) from SColtAggrFunc
]]></query>
sumofpowers is based on cern.jet.stat.Descriptive.sumOfPowers(DoubleArrayList data, int k). It returns the sum of powers of a data sequence (see Figure 8-18) as a double.
This function takes the following tuple arguments:
double1: data value.
int1: k.
For more information, see:
Consider the query qColtAggr52 in Example 8-91. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-92, the query returns the relation in Example 8-93.
Example 8-91 sumofpowers Function Query
<query id="qColtAggr52"><![CDATA[
select sumofpowers(c3, c1) from SColtAggrFunc
]]></query>
sumofsquareddeviations is based on cern.jet.stat.Descriptive.sumOfSquaredDeviations(int size, double variance). It returns the sum of squared mean deviation of a data sequence (see Figure 8-19) as a double.
This function takes the following tuple arguments:
double1: data value.
For more information, see
Consider the query qColtAggr53 in Example 8-94. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-95, the query returns the relation in Example 8-96.
Example 8-94 sumofsquareddeviations Function Query
<query id="qColtAggr53"><![CDATA[
select sumofsquareddeviations(c3) from SColtAggrFunc
]]></query>
sumofsquares is based on cern.jet.stat.Descriptive.sumOfSquares(DoubleArrayList data). It returns the sum of squares of a data sequence (see Figure 8-20) as a double.
This function takes the following tuple arguments:
double1: data value.
For more information, see:
Consider the query qColtAggr54 in Example 8-97. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-98, the query returns the relation in Example 8-99.
Example 8-97 sumofsquares Function Query
<query id="qColtAggr54"><![CDATA[
select sumofsquares(c3) from SColtAggrFunc
]]></query>
trimmedmean is based on cern.jet.stat.Descriptive.trimmedMean(DoubleArrayList sortedData, double mean, int left, int right). It returns the trimmed mean of an ascending sorted data sequence as a double.
This function takes the following tuple arguments:
double1: data value.
int1: left.
int2: right.
For more information, see:
Consider the query qColtAggr55 in Example 8-100. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-101, the query returns the relation in Example 8-102.
Example 8-100 trimmedmean Function Query
<query id="qColtAggr55"><![CDATA[
select trimmedmean(c3, c1, c1) from SColtAggrFunc
]]></query>
variance is based on cern.jet.stat.Descriptive.variance(int size, double sum, double sumOfSquares). It returns the variance of a data sequence (see Figure 8-21) as a double.
This function takes the following tuple arguments:
double1: data value.
For more information, see:
Consider the query qColtAggr57 in Example 8-103. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-104, the query returns the relation in Example 8-105.
Example 8-103 variance Function Query
<query id="qColtAggr57"><![CDATA[
select variance(c3) from SColtAggrFunc
]]></query>
weightedmean is based on cern.jet.stat.Descriptive.weightedMean(DoubleArrayList data, DoubleArrayList weights). It returns the weighted mean of a data sequence (see Figure 8-22) as a double.
This function takes the following tuple arguments:
double1: data value.
double2: weight value.
For more information, see:
Consider the query qColtAggr58 in Example 8-106. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-107, the query returns the relation in Example 8-108.
Example 8-106 weightedmean Function Query
<query id="qColtAggr58"><![CDATA[
select weightedmean(c3, c3) from SColtAggrFunc
]]></query>
winsorizedmean is based on cern.jet.stat.Descriptive.winsorizedMean(DoubleArrayList sortedData, double mean, int left, int right). It returns the winsorized mean of a sorted data sequence as a double.
This function takes the following tuple arguments:
double1: data value.
int1: left.
int2: right.
For more information, see:
Consider the query qColtAggr60 in Example 8-109. Given the data stream SColtAggrFunc with schema (c1 integer, c2 float, c3 double, c4 bigint) in Example 8-110, the query returns the relation in Example 8-111.
Example 8-109 winsorizedmean Function Query
<query id="qColtAggr60"><![CDATA[
select winsorizedmean(c3, c1, c1) from SColtAggrFunc
]]></query>