Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Support trigonometric functions acos, asin, atan, atan2, cos, cot, degrees, radians, sin, tan #599

Merged
merged 7 commits into from
Jul 22, 2020

Conversation

chloe-zh
Copy link
Member

@chloe-zh chloe-zh commented Jul 20, 2020

Issue #, if available:

Description of changes:

  • ACOS
    Usage: acos(x) calculate the arc cosine of x. Returns NULL if x is not in the range -1 to 1.
    Argument type: INTEGER/LONG/FLOAT/DOUBLE
    Return type: DOUBLE

  • ASIN
    Usage: asin(x) calculate the arc sine of x. Returns NULL if x is not in the range -1 to 1.
    Argument type: INTEGER/LONG/FLOAT/DOUBLE
    Return type: DOUBLE

  • ATAN
    Usage: atan(x) calculates the arc tangent of x. atan(y, x) calculates the arc tangent of y / x, except that the signs of both arguments are used to determine the quadrant of the result.
    Argument type: INTEGER/LONG/FLOAT/DOUBLE
    Return type: DOUBLE

  • ATAN2
    Usage: atan2(y, x) calculates the arc tangent of y / x, except that the signs of both arguments are used to determine the quadrant of the result.
    Argument type: INTEGER/LONG/FLOAT/DOUBLE
    Return type: DOUBLE

  • COS
    Usage: cos(x) calculate the cosine of x, where x is given in radians.
    Argument type: INTEGER/LONG/FLOAT/DOUBLE
    Return type: DOUBLE

  • COT
    Usage: cot(x) calculate the cotangent of x.
    Argument type: INTEGER/LONG/FLOAT/DOUBLE
    Return type: DOUBLE

  • DEGREES
    Usage: degrees(x) converts x from radians to degrees.
    Argument type: INTEGER/LONG/FLOAT/DOUBLE
    Return type: DOUBLE

  • RADIANS
    Usage: radians(x) converts x from degrees to radians.
    Argument type: INTEGER/LONG/FLOAT/DOUBLE
    Return type: DOUBLE

  • SIN
    Usage: sin(x) calculate the sine of x, where x is given in radians.
    Argument type: INTEGER/LONG/FLOAT/DOUBLE
    Return type: DOUBLE

  • TAN
    Usage: tan(x) calculate the tangent of x, where x is given in radians.
    Argument type: INTEGER/LONG/FLOAT/DOUBLE
    Return type: DOUBLE

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

# Conflicts:
#	core/src/main/java/com/amazon/opendistroforelasticsearch/sql/expression/DSL.java
#	core/src/main/java/com/amazon/opendistroforelasticsearch/sql/expression/operator/arthmetic/MathematicalFunction.java
#	core/src/test/java/com/amazon/opendistroforelasticsearch/sql/expression/operator/arthmetic/MathematicalFunctionTest.java
#	ppl/src/main/antlr/OpenDistroPPLParser.g4
#	sql/src/main/antlr/OpenDistroSQLParser.g4
@chloe-zh chloe-zh marked this pull request as ready for review July 20, 2020 20:54
@chloe-zh chloe-zh self-assigned this Jul 20, 2020
@chloe-zh chloe-zh marked this pull request as draft July 21, 2020 17:14
@chloe-zh chloe-zh marked this pull request as ready for review July 21, 2020 18:03
Copy link
Contributor

@penghuo penghuo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the change.

# Conflicts:
#	core/src/main/java/com/amazon/opendistroforelasticsearch/sql/expression/operator/arthmetic/MathematicalFunction.java
#	core/src/test/java/com/amazon/opendistroforelasticsearch/sql/expression/operator/arthmetic/MathematicalFunctionTest.java
#	integ-test/src/test/java/com/amazon/opendistroforelasticsearch/sql/ppl/MathematicalFunctionIT.java
#	integ-test/src/test/resources/correctness/expressions/functions.txt
#	ppl/src/main/antlr/OpenDistroPPLParser.g4
#	sql/src/main/antlr/OpenDistroSQLParser.g4
@chloe-zh chloe-zh merged commit 49883b9 into opendistro-for-elasticsearch:develop Jul 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants