Snowpark Scala API Reference1.19.1 < Back
 

# Packages

-  package root
  Definition Classes
    root
-  package com
  Definition Classes
    root
-  package snowflake
  Definition Classes
    com
-  package snowpark
  Definition Classes
    snowflake
-  object functions

  Provides utility functions that generate Column expressions that you can pass to DataFrame transformation methods.

  Provides utility functions that generate Column expressions that you can pass to DataFrame transformation methods. These functions generate references to columns, literals, and SQL expressions (e.g. "c + 1").

  This object also provides functions that correspond to Snowflake system-defined functions (built-in functions), including functions for aggregation and window functions.

  The following examples demonstrate the use of some of these functions:

      // Use columns and literals in expressions.
      df.select(col("c") + lit(1))

      // Call system-defined (built-in) functions.
      // This example calls the function that corresponds to the ADD_MONTHS() SQL function.
      df.select(add_months(col("d"), lit(3)))

      // Call system-defined functions that have no corresponding function in the functions object.
      // This example calls the RADIANS() SQL function, passing in values from the column "e".
      df.select(callBuiltin("radians", col("e")))

      // Call a user-defined function (UDF) by name.
      df.select(callUDF("some_func", col("c")))

      // Register and call an anonymous UDF.
      val myudf = udf((x:Int) => x + x)
      df.select(myudf(col("c")))

      // Evaluate an SQL expression
      df.select(sqlExpr("c + 1"))

  For functions that accept scala types, e.g. callUdf, callBuiltin, lit(), the mapping from scala types to Snowflake types is as follows:

      String => String
      Byte => TinyInt
      Int => Int
      Short => SmallInt
      Long => BigInt
      Float => Float
      Double => Double
      Decimal => Number
      Boolean => Boolean
      Array => Array
      Timestamp => Timestamp
      Date => Date

  Definition Classes
    snowpark
  Since

    0.1.0

- builtin

c

com.snowflake.snowpark.functions

# builtin 

###

#### case class builtin(functionName: String) extends Product with Serializable

Function object to invoke a Snowflake builtin. Use this to invoke any builtins not explicitly listed in this object.

Example

    val repeat = functions.builtin("repeat")
    df.select(repeat(col("col_1"), 3))

Since

  0.1.0

Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
 
Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. builtin
2. Serializable
3. Serializable
4. Product
5. Equals
6. AnyRef
7. Any

1. Hide All
2. Show All

Visibility

1. Public
2. All

### Instance Constructors

1.  new builtin(functionName: String)

### 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 apply(args: Any*): Column
5.  final def asInstanceOf[T0]: T0
   Definition Classes
     Any
6.  def clone(): AnyRef
   Attributes
     protected[lang]
   Definition Classes
     AnyRef
   Annotations
     @throws( ... ) @native() @HotSpotIntrinsicCandidate()
7.  final def eq(arg0: AnyRef): Boolean
   Definition Classes
     AnyRef
8.  val functionName: String
9.  final def getClass(): Class[_]
   Definition Classes
     AnyRef → Any
   Annotations
     @native() @HotSpotIntrinsicCandidate()
10.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
11.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
12.  final def notify(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native() @HotSpotIntrinsicCandidate()
13.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native() @HotSpotIntrinsicCandidate()
14.  final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
      AnyRef
15.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
16.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... ) @native()
17.  final def wait(): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )

### Deprecated Value Members

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

### Inherited from Serializable

### Inherited from Product

### Inherited from Equals

### Inherited from AnyRef

### Inherited from Any

### Ungrouped