double c Oracle Fusion Middleware Online Documentation Library

Colt Aggregate Functions 11-57 sumOfPowers Syntax Purpose sumOfPowers is based on cern.jet.stat.Descriptive.sumOfPowersDoubleArrayList data, int k. It returns the sum of powers of a data sequence see Figure 11–18 as a double. Figure 11–18 cern.jet.stat.Descriptive.sumOfPowersDoubleArrayList data, int k This function takes the following tuple arguments: ■ double1: data value. ■ int1: k. For more information, see: ■ http:acs.lbl.gov~hoschekcoltapicernjetstatDescriptive. htmlsumOfPowerscern.colt.list.DoubleArrayList,20int ■ Section 11.1.1, Oracle CQL Colt Aggregate Function Signatures and Tuple Arguments Examples Consider the query qColtAggr52 in Example 11–93 . Given the data stream SColtAggrFunc with schema c1 integer, c2 float, c3 double, c4 bigint in Example 11–94 , the query returns the relation in Example 11–95 . Example 11–93 sumOfPowers Function Query query id=qColtAggr52[CDATA[ select sumOfPowersc3, c1 from SColtAggrFunc ]]query Example 11–94 sumOfPowers Function Stream Input Timestamp Tuple 10 1, 0.5, 40.0, 8 1000 4, 0.7, 30.0, 6 1200 3, 0.89, 20.0, 12 2000 8, 0.4, 10.0, 4 h 8000 h 200000000 Example 11–95 sumOfPowers Function Relation Output Timestamp Tuple Kind Tuple -9223372036854775808:+ 10: - 10: + 40.0 1000: - 40.0 1000: + 3370000.0 11-58 Oracle Complex Event Processing CQL Language Reference 1200: - 3370000.0 1200: + 99000.0 2000: - 99000.0 2000: + 7.2354E12 Colt Aggregate Functions 11-59 sumOfSquaredDeviations Syntax Purpose sumOfSquaredDeviations is based on cern.jet.stat.Descriptive.sumOfSquaredDeviationsint size, double variance. It returns the sum of squared mean deviation of a data sequence see Figure 11–19 as a double. Figure 11–19 cern.jet.stat.Descriptive.sumOfSquaredDeviationsint size, double variance This function takes the following tuple arguments: ■ double1: data value. For more information, see ■ http:acs.lbl.gov~hoschekcoltapicernjetstatDescriptive. htmlsumOfSquaredDeviationsint,20double ■ Section 11.1.1, Oracle CQL Colt Aggregate Function Signatures and Tuple Arguments Examples Consider the query qColtAggr53 in Example 11–96 . Given the data stream SColtAggrFunc with schema c1 integer, c2 float, c3 double, c4 bigint in Example 11–97 , the query returns the relation in Example 11–98 . Example 11–96 sumOfSquaredDeviations Function Query query id=qColtAggr53[CDATA[ select sumOfSquaredDeviationsc3 from SColtAggrFunc ]]query Example 11–97 sumOfSquaredDeviations Function Stream Input Timestamp Tuple 10 1, 0.5, 40.0, 8 1000 4, 0.7, 30.0, 6 1200 3, 0.89, 20.0, 12 2000 8, 0.4, 10.0, 4 h 8000 h 200000000 Example 11–98 sumOfSquaredDeviations Function Relation Output Timestamp Tuple Kind Tuple -9223372036854775808:+ 10: - 10: + 0.0 1000: - 0.0 1000: + 25.0 11-60 Oracle Complex Event Processing CQL Language Reference 1200: - 25.0 1200: + 133.33333333333334 2000: - 133.33333333333334 2000: + 375.0 Colt Aggregate Functions 11-61 sumOfSquares Syntax Purpose sumOfSquares is based on cern.jet.stat.Descriptive.sumOfSquaresDoubleArrayList data. It returns the sum of squares of a data sequence see Figure 11–20 as a double. Figure 11–20 cern.jet.stat.Descriptive.sumOfSquaresDoubleArrayList data This function takes the following tuple arguments: ■ double1: data value. For more information, see: ■ http:acs.lbl.gov~hoschekcoltapicernjetstatDescriptive. htmlsumOfSquarescern.colt.list.DoubleArrayList ■ Section 11.1.1, Oracle CQL Colt Aggregate Function Signatures and Tuple Arguments Examples Consider the query qColtAggr54 in Example 11–99 . Given the data stream SColtAggrFunc with schema c1 integer, c2 float, c3 double, c4 bigint in Example 11–100 , the query returns the relation in Example 11–101 . Example 11–99 sumOfSquares Function Query query id=qColtAggr54[CDATA[ select sumOfSquaresc3 from SColtAggrFunc ]]query Example 11–100 sumOfSquares Function Stream Input Timestamp Tuple 10 1, 0.5, 40.0, 8 1000 4, 0.7, 30.0, 6 1200 3, 0.89, 20.0, 12 2000 8, 0.4, 10.0, 4 h 8000 h 200000000 Example 11–101 sumOfSquares Function Relation Output Timestamp Tuple Kind Tuple -9223372036854775808:+ 10: - 10: + 1600.0 1000: - 1600.0 1000: + 2500.0 1200: - 2500.0 1200: + 2900.0 11-62 Oracle Complex Event Processing CQL Language Reference 2000: - 2900.0 2000: + 3000.0 Colt Aggregate Functions 11-63 trimmedMean Syntax Purpose trimmedMean is based on cern.jet.stat.Descriptive.trimmedMeanDoubleArrayList 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: ■ http:acs.lbl.gov~hoschekcoltapicernjetstatDescriptive. htmltrimmedMeancern.colt.list.DoubleArrayList,20double,20 int,20int ■ Section 11.1.1, Oracle CQL Colt Aggregate Function Signatures and Tuple Arguments Examples Consider the query qColtAggr55 in Example 11–102 . Given the data stream SColtAggrFunc with schema c1 integer, c2 float, c3 double, c4 bigint in Example 11–103 , the query returns the relation in Example 11–104 . Example 11–102 trimmedMean Function Query query id=qColtAggr55[CDATA[ select trimmedMeanc3, c1, c1 from SColtAggrFunc ]]query Example 11–103 trimmedMean Function Stream Input Timestamp Tuple 10 1, 0.5, 40.0, 8 1000 4, 0.7, 30.0, 6 1200 3, 0.89, 20.0, 12 2000 8, 0.4, 10.0, 4 h 8000 h 200000000 Example 11–104 trimmedMean Function Relation Output Timestamp Tuple Kind Tuple -9223372036854775808:+ 11-64 Oracle Complex Event Processing CQL Language Reference variance Syntax Purpose variance is based on cern.jet.stat.Descriptive.varianceint size, double sum, double sumOfSquares. It returns the variance of a data sequence see Figure 11–21 as a double. Figure 11–21 cern.jet.stat.Descriptive.varianceint size, double sum, double sumOfSquares This function takes the following tuple arguments: ■ double1: data value. For more information, see: ■ http:acs.lbl.gov~hoschekcoltapicernjetstatDescriptive. htmlvarianceint,20double,20double ■ Section 11.1.1, Oracle CQL Colt Aggregate Function Signatures and Tuple Arguments Examples Consider the query qColtAggr57 in Example 11–105 . Given the data stream SColtAggrFunc with schema c1 integer, c2 float, c3 double, c4 bigint in Example 11–106 , the query returns the relation in Example 11–107 . Example 11–105 variance Function Query query id=qColtAggr57[CDATA[ select variancec3 from SColtAggrFunc ]]query Example 11–106 variance Function Stream Input Timestamp Tuple 10 1, 0.5, 40.0, 8 1000 4, 0.7, 30.0, 6 1200 3, 0.89, 20.0, 12 2000 8, 0.4, 10.0, 4 h 8000 h 200000000 Example 11–107 variance Function Relation Output Timestamp Tuple Kind Tuple -9223372036854775808:+ 10: - 10: + 0.0 1000: - 0.0 Colt Aggregate Functions 11-65 1000: + 25.0 1200: - 25.0 1200: + 66.66666666666667 2000: - 66.66666666666667 2000: + 125.0 11-66 Oracle Complex Event Processing CQL Language Reference weightedMean Syntax Purpose weightedMean is based on cern.jet.stat.Descriptive.weightedMeanDoubleArrayList data, DoubleArrayList weights. It returns the weighted mean of a data sequence see Figure 11–22 as a double. Figure 11–22 cern.jet.stat.Descriptive.weightedMeanDoubleArrayList data, DoubleArrayList weights This function takes the following tuple arguments: ■ double1: data value. ■ double2: weight value. For more information, see: ■ http:acs.lbl.gov~hoschekcoltapicernjetstatDescriptive. htmlweightedMeancern.colt.list.DoubleArrayList,20cern.colt .list.DoubleArrayList ■ Section 11.1.1, Oracle CQL Colt Aggregate Function Signatures and Tuple Arguments Examples Consider the query qColtAggr58 in Example 11–108 . Given the data stream SColtAggrFunc with schema c1 integer, c2 float, c3 double, c4 bigint in Example 11–109 , the query returns the relation in Example 11–110 . Example 11–108 weightedMean Function Query query id=qColtAggr58[CDATA[ select weightedMeanc3, c3 from SColtAggrFunc ]]query Example 11–109 weightedMean Function Stream Input Timestamp Tuple 10 1, 0.5, 40.0, 8 1000 4, 0.7, 30.0, 6 1200 3, 0.89, 20.0, 12 2000 8, 0.4, 10.0, 4 h 8000 h 200000000 Example 11–110 weightedMean Function Relation Output Timestamp Tuple Kind Tuple Colt Aggregate Functions 11-67 -9223372036854775808:+ 10: - 10: + 40.0 1000: - 40.0 1000: + 35.714285714285715 1200: - 35.714285714285715 1200: + 32.22222222222222 2000: - 32.22222222222222 2000: + 30.0 11-68 Oracle Complex Event Processing CQL Language Reference winsorizedMean Syntax Purpose winsorizedMean is based on cern.jet.stat.Descriptive.winsorizedMeanDoubleArrayList 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: ■ http:acs.lbl.gov~hoschekcoltapicernjetstatDescriptive. htmlwinsorizedMeancern.colt.list.DoubleArrayList,20double, 20int,20int ■ Section 11.1.1, Oracle CQL Colt Aggregate Function Signatures and Tuple Arguments Examples Consider the query qColtAggr60 in Example 11–111 . Given the data stream SColtAggrFunc with schema c1 integer, c2 float, c3 double, c4 bigint in Example 11–112 , the query returns the relation in Example 11–113 . Example 11–111 winsorizedMean Function Query query id=qColtAggr60[CDATA[ select winsorizedMeanc3, c1, c1 from SColtAggrFunc ]]query Example 11–112 winsorizedMean Function Stream Input Timestamp Tuple 10 1, 0.5, 40.0, 8 1000 4, 0.7, 30.0, 6 1200 3, 0.89, 20.0, 12 2000 8, 0.4, 10.0, 4 h 8000 h 200000000 Example 11–113 winsorizedMean Function Relation Output Timestamp Tuple Kind Tuple -9223372036854775808:+ 12 java.lang.Math Functions 12-1 12 java.lang.Math Functions Oracle CQL provides a variety of built-in functions based on the java.lang.Math class. For more information, see Section 1.1.11, Functions .

12.1 Introduction to Oracle CQL Built-In java.lang.Math Functions

Table 12–1 lists the built-in java.lang.Math functions that Oracle CQL provides. Table 12–1 Oracle CQL Built-in java.lang.Math Functions Type Function Trigonometric ■ sin ■ cos ■ tan ■ asin ■ acos ■ atan ■ atan2 ■ cosh ■ sinh ■ tanh Logarithmic ■ log1 ■ log101 ■ log1p Eulers Number ■ exp ■ expm1 Roots ■ cbrt ■ sqrt ■ hypot Signum Function ■ signum ■ signum1 Unit of Least Precision ■ ulp ■ ulp1 12-2 Oracle Complex Event Processing CQL Language Reference For more information, see: ■ Section 1.1.11, Functions ■ http:java.sun.comjavase6docsapijavalangMath.html Other ■ abs ■ abs1 ■ abs2 ■ abs3 ■ ceil1 ■ floor1 ■ IEEERemainder ■ pow ■ rint ■ round ■ round1 ■ todegrees ■ toradians 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 with h 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. Table 12–1 Cont. Oracle CQL Built-in java.lang.Math Functions Type Function java.lang.Math Functions 12-3 abs Syntax Purpose abs returns the absolute value of the input integer argument as an integer. For more information, see http:java.sun.comjavase6docsapijavalangMath.htmlabsin t . Examples Consider the query q66 in Example 12–1 . Given the data stream SFunc with schema c1 integer, c2 double, c3 bigint in Example 12–2 , the query returns the stream in Example 12–3 . Example 12–1 abs Function Query query id=q66[CDATA[ select absc1 from SFunc ]]query Example 12–2 abs Function Stream Input Timestamp Tuple 10 1,0.5,8 1000 -4,0.7,6 1200 -3,0.89,12 2000 8,0.4,4 Example 12–3 abs Function Stream Output Timestamp Tuple Kind Tuple 10: + 1 1000: + 4 1200: + 3 2000: + 8