You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tajo.apache.org by hy...@apache.org on 2014/09/27 01:52:09 UTC
[3/8] git commit: TAJO-667: Add math function documentation.
(Jongyoung Park via hyunsik)
TAJO-667: Add math function documentation. (Jongyoung Park via hyunsik)
Closes #153
Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/5a7e2725
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/5a7e2725
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/5a7e2725
Branch: refs/heads/block_iteration
Commit: 5a7e27254b913b81c8199eff0ae3855375a07559
Parents: 7510f88
Author: Hyunsik Choi <hy...@apache.org>
Authored: Tue Sep 23 08:03:30 2014 -0700
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Tue Sep 23 08:03:30 2014 -0700
----------------------------------------------------------------------
CHANGES | 2 +
.../functions/math_func_and_operators.rst | 276 ++++++++++++++++++-
2 files changed, 277 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tajo/blob/5a7e2725/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 21bdd8c..3372eb6 100644
--- a/CHANGES
+++ b/CHANGES
@@ -461,6 +461,8 @@ Release 0.9.0 - unreleased
SUB TASKS
+ TAJO-667: Add math function documentation. (Jongyoung Park via hyunsik)
+
TAJO-1016: Refactor worker rpc information. (jinho)
TAJO-1015: Add executionblock event in worker. (jinho)
http://git-wip-us.apache.org/repos/asf/tajo/blob/5a7e2725/tajo-docs/src/main/sphinx/functions/math_func_and_operators.rst
----------------------------------------------------------------------
diff --git a/tajo-docs/src/main/sphinx/functions/math_func_and_operators.rst b/tajo-docs/src/main/sphinx/functions/math_func_and_operators.rst
index c1329b3..9206056 100644
--- a/tajo-docs/src/main/sphinx/functions/math_func_and_operators.rst
+++ b/tajo-docs/src/main/sphinx/functions/math_func_and_operators.rst
@@ -2,4 +2,278 @@
Math Functions and Operators
*****************************
-.. todo::
\ No newline at end of file
+.. function:: abs (number int|float)
+
+ Returns absolute value
+
+ :param number: input number
+ :rtype: same as a parameter type
+ :example:
+
+ .. code-block:: sql
+
+ select abs(-9);
+ > 9
+
+.. function:: acos (number float)
+
+ Returns the arc cosine of number value
+
+ :param number: input number as radian
+ :rtype: float8
+ :example:
+
+ .. code-block:: sql
+
+ select acos(0.3);
+ > 1.2661036727794992
+
+.. function:: asin (number float)
+
+ Returns the arc sine of number value
+
+ :param number: input number as radian
+ :rtype: float8
+ :example:
+
+ .. code-block:: sql
+
+ select acos(0.8);
+ > 0.9272952180016123
+
+.. function:: atan (number float8)
+
+ Returns the arc tangent of number value
+
+ :param number: input number as radian
+ :rtype: float8
+ :example:
+
+ .. code-block:: sql
+
+ select atan(0.8);
+ > 0.6747409422235527
+
+.. function:: atan2 (y float, x float)
+
+ Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta)
+
+ :param y: the ordinate(y axis) coordinate
+ :param x: the abscissa(x axis) coordinate
+ :rtype: float8
+ :example:
+
+ .. code-block:: sql
+
+ select atan2(2.7, 0.3);
+ > 1.460139105621001
+
+.. function:: cbrt (number float)
+
+ Returns the cube root of a number
+
+ :param number: target real number
+ :rtype: float8
+ :example:
+
+ .. code-block:: sql
+
+ select cbrt(27.0);
+ > 3.0
+
+.. function:: ceil (number float)
+
+ Returns a smallest integer not less than argument
+
+ :param number: target real number
+ :rtype: int8
+ :example:
+
+ .. code-block:: sql
+
+ select ceil(-42.8);
+ > -42
+
+.. function:: cos (number float)
+
+ Returns the cosine of a number
+
+ :param number: target real number
+ :rtype: float8
+ :example:
+
+ .. code-block:: sql
+
+ select cos(0.7);
+ > 0.7648421872844885
+
+.. function:: degrees (number float)
+
+ Converts radians to degrees
+
+ :param number: radian value
+ :rtype: float8
+ :example:
+
+ .. code-block:: sql
+
+ select degrees(0.8);
+ > 45.83662361046586
+
+.. function:: div (num1 int, num2 int)
+
+ Integer division truncates resut
+
+ :param num1: number to be divided
+ :param num2: number to divide
+ :rtype: int8
+ :example:
+
+ .. code-block:: sql
+
+ select div(8,3);
+ > 2
+
+.. function:: exp (number float)
+
+ Returns Euler's number e raised to the power of a number
+
+ :param number: input number
+ :rtype: float8
+ :example:
+
+ .. code-block:: sql
+
+ select exp(1.0);
+ > 2.718281828459045
+
+.. function:: floor (number float)
+
+ Returns a largest integer not greater than argument
+
+ :param number: target real number
+ :rtype: int8
+ :example:
+
+ .. code-block:: sql
+
+ select floor(53.1);
+ > 53
+
+.. function:: mod (num1 int, num2 int)
+
+ Returns remainder of num1 / num2
+
+ :param num1: number to be divided
+ :param num2: number to divide
+ :rtype: int8
+ :example:
+
+ .. code-block:: sql
+
+ select mod(10,3);
+ > 1
+
+.. function:: pi ()
+
+ Returns constant value of pi
+
+ :rtype: float8
+ :example:
+
+ .. code-block:: sql
+
+ select pi();
+ > 3.141592653589793
+
+.. function:: pow (x float, y float)
+
+ Returns value of x raised to the power of y
+
+ :param x: base number
+ :param y: exponent
+ :rtype: float8
+ :example:
+
+ .. code-block:: sql
+
+ select pow(2.0, 10.0);
+ > 1024.0
+
+.. function:: radians (number float)
+
+ Converts degrees to radians
+
+ :param number: degree value
+ :rtype: float8
+ :example:
+
+ .. code-block:: sql
+
+ select radians(45.0);
+ > 0.7853981633974483
+
+.. function:: round (number int|float)
+
+ Rounds to nearest integer
+
+ :param number: target number
+ :rtype: int8
+ :example:
+
+ .. code-block:: sql
+
+ select round(5.1);
+ > 5
+
+.. function:: sign (number int|float)
+
+ Returns sign of argument as -1, 0, 1
+
+ :param number: target number
+ :rtype: float8
+ :example:
+
+ .. code-block:: sql
+
+ select sign(-8.4);
+ > -1.0
+
+.. function:: sin (number float)
+
+ Returns the sine of number value
+
+ :param number: target number
+ :rtype: float8
+ :example:
+
+ .. code-block:: sql
+
+ select sin(1.0);
+ > 0.8414709848078965
+
+.. function:: sqrt (number float8)
+
+ Returns the square root of a number
+
+ :param number: target number
+ :rtype: float8
+ :example:
+
+ .. code-block:: sql
+
+ select sqrt(256.0);
+ > 16.0
+
+.. function:: tan (number float)
+
+ Returns the tangent of number value
+
+ :param number: target number
+ :rtype: float8
+ :example:
+
+ .. code-block:: sql
+
+ select tan(0.2);
+ > 0.2027100355086725