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

    https://github.com/apache/spark/pull/10911#discussion_r50877569
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/DataFrameStatFunctions.scala ---
    @@ -309,4 +311,84 @@ 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`
    +   * @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`
    +   * @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`
    +   * @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`
    +   * @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
    +    val supportedTypes: Set[DataType] = Set(ByteType, ShortType, 
IntegerType, LongType, StringType)
    +
    +    require(
    +      supportedTypes.contains(colType),
    --- End diff --
    
    Good point


---
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