Hi,

We have implemented below Math operations (all the Math operations available
in Hive) as extensions to Siddhi engine.

round(DOUBLE a)round(DOUBLE a, INT d)floor(DOUBLE a)ceil(DOUBLE a),
ceiling(DOUBLE a)rand(), rand(INT seed)exp(DOUBLE a), exp(DECIMAL a)ln(DOUBLE
a), ln(DECIMAL a)log10(DOUBLE a), log10(DECIMAL a)log2(DOUBLE a),
log2(DECIMAL a)log(DOUBLE base, DOUBLE a)
log(DECIMAL base, DECIMAL a)pow(DOUBLE a, DOUBLE p), power(DOUBLE a, DOUBLE
p)sqrt(DOUBLE a), sqrt(DECIMAL a)bin(BIGINT a)hex(BIGINT a) hex(STRING a)
hex(BINARY a)unhex(STRING a)conv(BIGINT num, INT from_base, INT to_base),
conv(STRING num, INT from_base, INT to_base)abs(DOUBLE a)pmod(INT a, INT
b), pmod(DOUBLE a, DOUBLE b)sin(DOUBLE a), sin(DECIMAL a)asin(DOUBLE a),
asin(DECIMAL a)cos(DOUBLE a), cos(DECIMAL a)acos(DOUBLE a),
acos(DECIMAL a)tan(DOUBLE
a), tan(DECIMAL a)atan(DOUBLE a), atan(DECIMAL a)degrees(DOUBLE a),
degrees(DECIMAL a)radians(DOUBLE a), radians(DOUBLE a)positive(INT a),
positive(DOUBLE a)negative(INT a), negative(DOUBLE a)sign(DOUBLE a),
sign(DECIMAL a)e()pi()


Eg:You can use the operations as below:

*from InStreamSample1*
*select custom:pi()*
*insert into OutStreamSample1;*

*from InStreamSample1*
*select custom:tan(parameter1)*
*insert into OutStreamSample1;*

*from InStreamSample1*
*select custom:pmod(parameter1,parameter2)*
*insert into OutStreamSample1;*


We used built-in math operations available in java.lang.Math package and we
have implemented the operations which are not available in the mentioned
package (eg: pmod, positive,negative,unhex etc).
Separate classes were created for each math operation/extension and custom
function names are as same as the operation names in java.lang.Math.

Appreciate if someone could point out if there are any other missing/needed
operations or any improvements regarding this..


Thanks,
-- 
*Lahiru Cooray*
Software Engineer
WSO2, Inc.;http://wso2.com/
lean.enterprise.middleware

Mobile: +94 715 654154

Attachment: Hive Math Operations (1).rtf
Description: RTF file

_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to