klotz: topn*

0 bookmark(s) - Sort by: Date ↓ / Title / - Bookmarks from other users for this tag

  1. mport org.apache.spark.sql.expressions.Window
    import org.apache.spark.sql.functions.{rank, desc}

    val n: Int = ???

    // Window definition
    val w = Window.partitionBy($"user").orderBy(desc("rating"))

    // Filter
    df.withColumn("rank", rank.over(w)).where($"rank" <= n)
    2019-06-10 Tags: , , , by klotz

Top of the page

First / Previous / Next / Last / Page 1 of 0 SemanticScuttle - klotz.me: Tags: topn

About - Propulsed by SemanticScuttle