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

Support mathematical functions rand and constants e, pi #591

Merged
merged 6 commits into from
Jul 22, 2020

Conversation

chloe-zh
Copy link
Member

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

Issue #, if available:

Description of changes:

  • RAND
    Usage: rand()/rand(N) returns a random floating-point value in the range 0 <= value < 1.0. If integer N is specified, the seed is initialized prior to execution. One implication of this behavior is with identical argument N, rand(N) returns the same value each time, and thus produces a repeatable sequence of column values.
    Argument type: x: STRING, a: INTEGER, b: INTEGER
    Return type: STRING

  • E
    Usage: e() returns the Euler's number
    Return type: DOUBLE

  • PI
    Usage: pi() returns the constant pi
    Return type: DOUBLE

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

@chloe-zh chloe-zh self-assigned this Jul 17, 2020
# Conflicts:
#	core/src/main/java/com/amazon/opendistroforelasticsearch/sql/expression/DSL.java
#	core/src/main/java/com/amazon/opendistroforelasticsearch/sql/expression/function/BuiltinFunctionName.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
#	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/OpenDistroPPLLexer.g4
#	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 19:38
sql/src/main/antlr/OpenDistroSQLParser.g4 Show resolved Hide resolved
docs/user/dql/functions.rst Outdated Show resolved Hide resolved
docs/user/dql/functions.rst Outdated Show resolved Hide resolved
Copy link
Member

@dai-chen dai-chen left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

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.

LGTM

@chloe-zh chloe-zh merged commit 78a51a4 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