class RelationalGroupedDataFrame extends AnyRef
Represents an underlying DataFrame with rows that are grouped by common values. Can be used to define aggregations on these grouped DataFrames.
Example:
val groupedDf: RelationalGroupedDataFrame = df.groupBy("dept") val aggDf: DataFrame = groupedDf.agg(groupedDf("salary") -> "mean")
The methods DataFrame.groupBy, DataFrame.cube and DataFrame.rollup return an instance of type RelationalGroupedDataFrame
- Since
0.1.0
- Alphabetic
- By Inheritance
- RelationalGroupedDataFrame
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def agg(exprs: Map[Column, String]): DataFrame
Returns a DataFrame with computed aggregates.
Returns a DataFrame with computed aggregates. The first element of the 'expr' pair is the column to aggregate and the second element is the aggregate function to compute. The following example computes the mean of the price column and the sum of the sales column. The name of the aggregate function to compute must be a valid Snowflake aggregate function "average" and "mean" can be used to specify "avg".
import com.snowflake.snowpark.functions.col df.groupBy("itemType").agg(Map( col("price") -> "mean", col("sales") -> "sum" ))
- returns
- Since
0.1.0
- def agg(exprs: Array[Column]): DataFrame
Returns a DataFrame with aggregated computed according to the supplied Column expressions.
Returns a DataFrame with aggregated computed according to the supplied Column expressions. com.snowflake.snowpark.functions contains some built-in aggregate functions that can be used.
- returns
- Since
0.9.0
- def agg[T](exprs: Seq[Column])(implicit arg0: ClassTag[T]): DataFrame
Returns a DataFrame with aggregated computed according to the supplied Column expressions.
Returns a DataFrame with aggregated computed according to the supplied Column expressions. com.snowflake.snowpark.functions contains some built-in aggregate functions that can be used.
impoer com.snowflake.snowpark.functions._ df.groupBy("itemType").agg(Seq( mean($"price"), sum($"sales")))
- returns
- Since
0.2.0
- def agg(expr: Column, exprs: Column*): DataFrame
Returns a DataFrame with aggregated computed according to the supplied Column expressions.
Returns a DataFrame with aggregated computed according to the supplied Column expressions. com.snowflake.snowpark.functions contains some built-in aggregate functions that can be used.
impoer com.snowflake.snowpark.functions._ df.groupBy("itemType").agg( mean($"price"), sum($"sales"))
- returns
- Since
0.1.0
- def agg(exprs: Seq[(Column, String)]): DataFrame
Returns a DataFrame with computed aggregates.
Returns a DataFrame with computed aggregates. The first element of the 'expr' pair is the column to aggregate and the second element is the aggregate function to compute. The following example computes the mean of the price column and the sum of the sales column. The name of the aggregate function to compute must be a valid Snowflake aggregate function "average" and "mean" can be used to specify "avg".
import com.snowflake.snowpark.functions.col df.groupBy("itemType").agg(Seq( col("price") -> "mean", col("sales") -> "sum"))
- returns
- Since
0.2.0
- def agg(expr: (Column, String), exprs: (Column, String)*): DataFrame
Returns a DataFrame with computed aggregates.
Returns a DataFrame with computed aggregates. The first element of the 'expr' pair is the column to aggregate and the second element is the aggregate function to compute. The following example computes the mean of the price column and the sum of the sales column. The name of the aggregate function to compute must be a valid Snowflake aggregate function "average" and "mean" can be used to specify "avg".
import com.snowflake.snowpark.functions.col df.groupBy("itemType").agg( col("price") -> "mean", col("sales") -> "sum")
- returns
- Since
0.1.0
- def any_value(cols: Column*): DataFrame
Returns non-deterministic values for the specified columns.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def avg(cols: Column*): DataFrame
Return the average for the specified numeric columns.
- def builtin(aggName: String)(cols: Column*): DataFrame
Computes the builtin aggregate 'aggName' over the specified columns.
Computes the builtin aggregate 'aggName' over the specified columns. Use this function to invoke any aggregates not explicitly listed in this class.
For example:
df.groupBy(col("a")).builtin("max")(col("b"))
- aggName
the Name of an aggregate function.
- returns
- Since
0.6.0
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
- def count(): DataFrame
Return the number of rows for each group.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def max(cols: Column*): DataFrame
Return the max for the specified numeric columns.
- def mean(cols: Column*): DataFrame
Return the average for the specified numeric columns.
- def median(cols: Column*): DataFrame
Return the median for the specified numeric columns.
- def min(cols: Column*): DataFrame
Return the min for the specified numeric columns.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def sum(cols: Column*): DataFrame
Return the sum for the specified numeric columns.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)