-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support sin cos etc trigonometric function in sql #7182
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xueyumusic, could you please test this patch against the latest master (it uses EXPRESSION_POST_AGG
, which has been renamed recently) and also add docs to math-expr.md and sql.md for the new functions?
Other than those things and the line comments, this looks good to me.
throw new IAE("Function[%s] needs 0 argument", name()); | ||
} | ||
|
||
return ExprEval.of(Math.PI); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be extracted to a private static final
constant.
.context(QUERY_CONTEXT_DONT_SKIP_EMPTY_BUCKETS) | ||
.build()), | ||
ImmutableList.of( | ||
new Object[]{11.0, Math.sin(Math.PI / 6), Math.cos(Math.PI / 6), Math.tan(Math.PI / 6), Math.cos(Math.PI / 6) / Math.sin(Math.PI / 6), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might need to put one result on each line to satisfy the style checker.
494e4a6
to
08db94d
Compare
Hi, @gianm , Thanks a lot for review. I have rebased on master and updated the codes, thank you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks! 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 thank you!
This PR tries to support sin, cos, tan, cot, asin, acos, atan, atan2 etc function and pi constant in sql based on the current calcite framework. They are common math functions.