-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add min, max Spark aggregate functions #9868
Add min, max Spark aggregate functions #9868
Conversation
✅ Deploy Preview for meta-velox canceled.
|
82b5b7f
to
a4cda31
Compare
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.
Thanks! Looks good overall.
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.
Thanks. Looks good to me.
8ecc602
to
7488e38
Compare
@mbasmanova and @Yuhta , could you help to review? Thanks. |
d2676f3
to
dfa9e24
Compare
Kindly ping, could you help to review? Thanks. |
f62e8fd
to
238c4f6
Compare
@jinchengchenghh , do you have more comments? Thanks. |
3e0d02d
to
954f780
Compare
@mbasmanova , could you please help review this PR? Thanks. |
d276b70
to
8f239a3
Compare
8f239a3
to
42ccc17
Compare
@rui-mo , is it ok to merge this PR? 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.
Thanks. Added several nits.
8d00f3a
to
de9d83f
Compare
@@ -290,6 +290,20 @@ struct Timestamp { | |||
/// successful. | |||
static int64_t calendarUtcToEpoch(const std::tm& tm); | |||
|
|||
/// Truncates a Timestamp value to the specified precision. | |||
static Timestamp truncate(Timestamp ts, TimestampPrecision precision) { |
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.
Nice. 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.
@zhli1142015 Thanks.
@kevinwilfong has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@zhli1142015 Would you resolve the conflicts? Thanks. |
a794277
to
ae6a473
Compare
Done, thanks. |
@kevinwilfong has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Sorry but could you rebase again, I'm still seeing conflicts in velox/functions/lib/aggregates/CMakeLists.txt |
ae6a473
to
c9ff748
Compare
@kevinwilfong has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@kevinwilfong merged this pull request in e5671c0. |
…ox/functions/prestosql/aggregates/MinMaxAggregates.cpp Add min, max Spark aggregate functions (facebookincubator#9868) Summary: There are two semantic differences between Presto and Spark. 1. Nested NULLs are compared as values in Spark and as "unknown value" in Presto. 2. The timestamp type represents a time instant in microsecond precision in Spark, but millisecond precision in Presto. Therefore, we need to implement min and max functions for Spark. In this PR, 1. Move Presto `min` and `max` aggregation function implements to lib folder. 2. Add `getMinFunctionFactory` and `getMaxFunctionFactory` which allow callers to register max & min functions with different behaviors. Pull Request resolved: facebookincubator#9868 Reviewed By: mbasmanova Differential Revision: D60051468 Pulled By: kevinwilfong fbshipit-source-id: 1f056420d6909174a35d336e4e1b413a87ef7665
…ox/functions/prestosql/aggregates/MinMaxAggregates.cpp (#503) Add min, max Spark aggregate functions (facebookincubator#9868) Summary: There are two semantic differences between Presto and Spark. 1. Nested NULLs are compared as values in Spark and as "unknown value" in Presto. 2. The timestamp type represents a time instant in microsecond precision in Spark, but millisecond precision in Presto. Therefore, we need to implement min and max functions for Spark. In this PR, 1. Move Presto `min` and `max` aggregation function implements to lib folder. 2. Add `getMinFunctionFactory` and `getMaxFunctionFactory` which allow callers to register max & min functions with different behaviors. Pull Request resolved: facebookincubator#9868 Reviewed By: mbasmanova Differential Revision: D60051468 Pulled By: kevinwilfong fbshipit-source-id: 1f056420d6909174a35d336e4e1b413a87ef7665 Co-authored-by: zhli1142015 <zhli@microsoft.com>
There are two semantic differences between Presto and Spark.
Presto.
Spark, but millisecond precision in Presto.
Therefore, we need to implement min and max functions for Spark. In this PR,
min
andmax
aggregation function implements to lib folder.getMinFunctionFactory
andgetMaxFunctionFactory
which allow callersto register max & min functions with different behaviors.