Snowpark Scala API Reference1.21.0 < Back


# Packages

-  package root
  Definition Classes
    root
-  package com
  Definition Classes
    root
-  package snowflake
  Definition Classes
    com
-  package snowpark
  Definition Classes
    snowflake
-  package types

  This package contains all Snowpark logical types.

  This package contains all Snowpark logical types.

  Definition Classes
    snowpark
  Since

    0.1.0

-  package udaf
  Definition Classes
    snowpark
-  package udtf
  Definition Classes
    snowpark
- AggregateFunction
- AsyncJob
- CaseExpr
- Column
- CopyableDataFrame
- CopyableDataFrameAsyncActor
- DataFrame
- DataFrameAsyncActor
- DataFrameNaFunctions
- DataFrameReader
- DataFrameStatFunctions
- DataFrameWriter
- DataFrameWriterAsyncActor
- DeleteResult
- FileOperation
- GetResult
- GroupingSets
- HasCachedResult
- MatchedClauseBuilder
- MergeBuilder
- MergeBuilderAsyncActor
- MergeResult
- MergeTypedAsyncJob
- NotMatchedClauseBuilder
- PublicPreview
- PutResult
- RelationalGroupedDataFrame
- Row
- SProcRegistration
- SaveMode
- Session
- SnowparkClientException
- StoredProcedure
- TableFunction
- TypedAsyncJob
- UDAFRegistration
- UDFRegistration
- UDTFRegistration
- Updatable
- UpdatableAsyncActor
- UpdateResult
- UserDefinedFunction
- Window
- WindowSpec
- WriteFileResult
- functions
- tableFunctions

c

com.snowflake.snowpark

# RelationalGroupedDataFrame

###

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

Linear Supertypes
AnyRef, Any

Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. RelationalGroupedDataFrame
2. AnyRef
3. Any

1. Hide All
2. Show All

Visibility

1. Public
2. Protected

### Value Members

1.  final def !=(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
2.  final def ##: Int
   Definition Classes
     AnyRef → Any
3.  final def ==(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
4.  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

     a DataFrame

   Since

     0.1.0

5.  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

     a DataFrame

   Since

     0.9.0

6.  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

     a DataFrame

   Since

     0.2.0

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

     a DataFrame

   Since

     0.1.0

8.  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

     a DataFrame

   Since

     0.2.0

9.  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

     a DataFrame

   Since

     0.1.0

10.  def any_value(cols: Column*): DataFrame

    Returns non-deterministic values for the specified columns.

    Returns non-deterministic values for the specified columns.

    returns

      A DataFrame

    Since

      0.12.0

11.  final def asInstanceOf[T0]: T0
    Definition Classes
      Any
12.  def avg(cols: Column*): DataFrame

    Return the average for the specified numeric columns.

    Return the average for the specified numeric columns.

    returns

      a DataFrame

    Since

      0.4.0

13.  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

      A DataFrame

    Since

      0.6.0

14.  def clone(): AnyRef
    Attributes
      protected[lang]
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
15.  def count(): DataFrame

    Return the number of rows for each group.

    Return the number of rows for each group.

    returns

      A DataFrame

    Since

      0.1.0

16.  final def eq(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
17.  def equals(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef → Any
18.  final def getClass(): Class[_ <: AnyRef]
    Definition Classes
      AnyRef → Any
    Annotations
      @HotSpotIntrinsicCandidate() @native()
19.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
    Annotations
      @HotSpotIntrinsicCandidate() @native()
20.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
21.  def max(cols: Column*): DataFrame

    Return the max for the specified numeric columns.

    Return the max for the specified numeric columns.

    returns

      A DataFrame

    Since

      0.4.0

22.  def mean(cols: Column*): DataFrame

    Return the average for the specified numeric columns.

    Return the average for the specified numeric columns. Alias of avg

    returns

      a DataFrame

    Since

      0.4.0

23.  def median(cols: Column*): DataFrame

    Return the median for the specified numeric columns.

    Return the median for the specified numeric columns.

    returns

      A DataFrame

    Since

      0.5.0

24.  def min(cols: Column*): DataFrame

    Return the min for the specified numeric columns.

    Return the min for the specified numeric columns.

    returns

      A DataFrame

    Since

      0.1.0

25.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
26.  final def notify(): Unit
    Definition Classes
      AnyRef
    Annotations
      @HotSpotIntrinsicCandidate() @native()
27.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
    Annotations
      @HotSpotIntrinsicCandidate() @native()
28.  def sum(cols: Column*): DataFrame

    Return the sum for the specified numeric columns.

    Return the sum for the specified numeric columns.

    returns

      a DataFrame

    Since

      0.1.0

29.  final def synchronized[T0](arg0: => T0): T0
    Definition Classes
      AnyRef
30.  def toString(): String
    Definition Classes
      AnyRef → Any
31.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.InterruptedException])
32.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.InterruptedException]) @native()
33.  final def wait(): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.InterruptedException])

### Deprecated Value Members

1.  def finalize(): Unit
   Attributes
     protected[lang]
   Definition Classes
     AnyRef
   Annotations
     @throws(classOf[java.lang.Throwable]) @Deprecated
   Deprecated

     (Since version 9)

### Inherited from AnyRef

### Inherited from Any

### Ungrouped