You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by gu...@apache.org on 2020/09/02 01:15:27 UTC

[spark] branch branch-2.4 updated: [SPARK-32771][DOCS] The example of expressions.Aggregator in Javadoc / Scaladoc is wrong

This is an automated email from the ASF dual-hosted git repository.

gurwls223 pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-2.4 by this push:
     new 081c12b  [SPARK-32771][DOCS] The example of expressions.Aggregator in Javadoc / Scaladoc is wrong
081c12b is described below

commit 081c12bb2f9d72c3776e626ec23e871a24a88a88
Author: Kousuke Saruta <sa...@oss.nttdata.com>
AuthorDate: Wed Sep 2 10:03:07 2020 +0900

    [SPARK-32771][DOCS] The example of expressions.Aggregator in Javadoc / Scaladoc is wrong
    
    ### What changes were proposed in this pull request?
    
    This PR modifies an example for `expressions.Aggregator` in Javadoc and Scaladoc.
    The definition of `bufferEncoder` and `outputEncoder` are added.
    
    ### Why are the changes needed?
    
    To correct the example.
    The current example is wrong and doesn't work because `bufferEncoder` and `outputEncoder` are not defined.
    
    ### Does this PR introduce _any_ user-facing change?
    
    Yes.
    Before this change, the scaladoc and javadoc are like as follows.
    ![wrong-example-java](https://user-images.githubusercontent.com/4736016/91897528-5ebf3580-ecd5-11ea-8d7b-e846b776ebbb.png)
    ![wrong-example](https://user-images.githubusercontent.com/4736016/91897509-58c95480-ecd5-11ea-81a3-98774083b689.png)
    
    After this change, the docs are like as follows.
    ![fixed-example-java](https://user-images.githubusercontent.com/4736016/91897592-78607d00-ecd5-11ea-9e55-03fd9c9c6b54.png)
    ![fixed-example](https://user-images.githubusercontent.com/4736016/91897609-7c8c9a80-ecd5-11ea-837e-9dbcada6cd53.png)
    
    ### How was this patch tested?
    
    Build with `build/sbt unidoc` and confirmed the generated javadoc/scaladoc and got the screenshots above.
    
    Closes #29617 from sarutak/fix-aggregator-doc.
    
    Authored-by: Kousuke Saruta <sa...@oss.nttdata.com>
    Signed-off-by: HyukjinKwon <gu...@apache.org>
    (cherry picked from commit 812d0918a88ca5677c0bdbd8cffd765d53de50ca)
    Signed-off-by: HyukjinKwon <gu...@apache.org>
---
 .../src/main/scala/org/apache/spark/sql/expressions/Aggregator.scala    | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sql/core/src/main/scala/org/apache/spark/sql/expressions/Aggregator.scala b/sql/core/src/main/scala/org/apache/spark/sql/expressions/Aggregator.scala
index 1e07620..d92aa1d 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/expressions/Aggregator.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/expressions/Aggregator.scala
@@ -37,6 +37,8 @@ import org.apache.spark.sql.execution.aggregate.TypedAggregateExpression
  *     def reduce(b: Int, a: Data): Int = b + a.i
  *     def merge(b1: Int, b2: Int): Int = b1 + b2
  *     def finish(r: Int): Int = r
+ *     def bufferEncoder: Encoder[Int] = Encoders.scalaInt
+ *     def outputEncoder: Encoder[Int] = Encoders.scalaInt
  *   }.toColumn()
  *
  *   val ds: Dataset[Data] = ...


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org