-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-14451][SQL] Move encoder definition into Aggregator interface #12231
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
Conversation
|
Test build #55186 has finished for PR 12231 at commit
|
|
Is it possible that users want to use one |
|
I don't know -- it's possible but I don't know how often you'd see that ... |
|
Test build #55189 has finished for PR 12231 at commit
|
|
Test build #55194 has finished for PR 12231 at commit
|
## What changes were proposed in this pull request? The Scala Dataset public API currently only allows users to specify encoders through SQLContext.implicits. This is OK but sometimes people want to explicitly get encoders without a SQLContext (e.g. Aggregator implementations). This patch adds public APIs to Encoders class for getting Scala encoders. ## How was this patch tested? None - I will update test cases once #12231 is merged. Author: Reynold Xin <[email protected]> Closes #12232 from rxin/SPARK-14452.
This reverts commit 609e8ebaca80171f483c6e3ad25f1bd3fe0b2ff1.
|
Test build #55191 has finished for PR 12231 at commit
|
|
Test build #2766 has finished for PR 12231 at commit
|
|
Test build #55202 has finished for PR 12231 at commit
|
|
Test build #55299 has finished for PR 12231 at commit
|
|
Test build #55315 has finished for PR 12231 at commit
|
|
Test build #55316 has finished for PR 12231 at commit
|
| override def merge(b1: Double, b2: Double): Double = b1 + b2 | ||
| override def finish(reduction: Double): Double = reduction | ||
|
|
||
| override def bufferEncoder: Encoder[Double] = ExpressionEncoder[Double]() |
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.
use Encoders.scalaDouble?
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.
this is internal, so it is not that bad to use the internal api.
|
LGTM |
|
Merging in master. Thanks! |
What changes were proposed in this pull request?
When we first introduced Aggregators, we required the user of Aggregators to (implicitly) specify the encoders. It would actually make more sense to have the encoders be specified by the implementation of Aggregators, since each implementation should have the most state about how to encode its own data type.
Note that this simplifies the Java API because Java users no longer need to explicitly specify encoders for aggregators.
How was this patch tested?
Updated unit tests.