Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10911#discussion_r50786975
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/DataFrameStatFunctions.scala ---
    @@ -309,4 +311,88 @@ final class DataFrameStatFunctions private[sql](df: 
DataFrame) {
       def sampleBy[T](col: String, fractions: ju.Map[T, jl.Double], seed: 
Long): DataFrame = {
         sampleBy(col, fractions.asScala.toMap.asInstanceOf[Map[T, Double]], 
seed)
       }
    +
    +  /**
    +   * Builds a Count-Min sketch over a specified column.
    +   *
    +   * @param colName name of the column over which the sketch is built
    +   * @param depth depth of the sketch
    +   * @param width width of the sketch
    +   * @param seed random seed
    +   * @return a [[CountMinSketch]] over column `colName`
    +   * @see [[http://www.eecs.harvard.edu/~michaelm/CS222/countmin.pdf]]
    +   * @since 2.0.0
    +   */
    +  def countMinSketch(colName: String, depth: Int, width: Int, seed: Int): 
CountMinSketch = {
    +    countMinSketch(Column(colName), depth, width, seed)
    +  }
    +
    +  /**
    +   * Builds a Count-Min sketch over a specified column.
    +   *
    +   * @param colName name of the column over which the sketch is built
    +   * @param eps relative error of the sketch
    +   * @param confidence confidence of the sketch
    +   * @param seed random seed
    +   * @return a [[CountMinSketch]] over column `colName`
    +   * @see [[http://www.eecs.harvard.edu/~michaelm/CS222/countmin.pdf]]
    +   * @since 2.0.0
    +   */
    +  def countMinSketch(
    +      colName: String, eps: Double, confidence: Double, seed: Int): 
CountMinSketch = {
    +    countMinSketch(Column(colName), eps, confidence, seed)
    +  }
    +
    +  /**
    +   * Builds a Count-Min sketch over a specified column.
    +   *
    +   * @param col the column over which the sketch is built
    +   * @param depth depth of the sketch
    +   * @param width width of the sketch
    +   * @param seed random seed
    +   * @return a [[CountMinSketch]] over column `colName`
    +   * @see [[http://www.eecs.harvard.edu/~michaelm/CS222/countmin.pdf]]
    +   * @since 2.0.0
    +   */
    +  def countMinSketch(col: Column, depth: Int, width: Int, seed: Int): 
CountMinSketch = {
    +    countMinSketch(col, CountMinSketch.create(depth, width, seed))
    +  }
    +
    +  /**
    +   * Builds a Count-Min sketch over a specified column.
    +   *
    +   * @param col the column over which the sketch is built
    +   * @param eps relative error of the sketch
    +   * @param confidence confidence of the sketch
    +   * @param seed random seed
    +   * @return a [[CountMinSketch]] over column `colName`
    +   * @see [[http://www.eecs.harvard.edu/~michaelm/CS222/countmin.pdf]]
    +   * @since 2.0.0
    +   */
    +  def countMinSketch(col: Column, eps: Double, confidence: Double, seed: 
Int): CountMinSketch = {
    +    countMinSketch(col, CountMinSketch.create(eps, confidence, seed))
    +  }
    +
    +  private def countMinSketch(col: Column, zero: CountMinSketch): 
CountMinSketch = {
    +    val singleCol = df.select(col)
    +    val colType = singleCol.schema.head.dataType
    +
    +    require({
    +      val supportedTypes: Set[DataType] =
    +        Set(ByteType, ShortType, IntegerType, LongType, StringType)
    +      supportedTypes.contains(colType)
    +    }, s"Count-Min Sketch doesn't support data type $colType yet.")
    --- End diff --
    
    "Count-min Sketch only supports byte, short, int, long, string type and 
does not support xxx type."
    
    
    Don't say yet because that sounds like we already have plan to fix all of 
them.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to