Snowpark Scala API Reference1.20.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

- ArrayType
- BinaryType
- BooleanType
- ByteType
- ColumnIdentifier
- DataType
- DateType
- DecimalType
- DoubleType
- FloatType
- Geography
- GeographyType
- Geometry
- GeometryType
- IntegerType
- LongType
- MapType
- ShortType
- StringType
- StructField
- StructType
- TimeType
- TimestampType
- Variant
- VariantType

c

com.snowflake.snowpark.types

# Variant

###

#### class Variant extends AnyRef

Representation of Snowflake Variant data

Since

  0.2.0

Linear Supertypes
AnyRef, Any

Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. Variant
2. AnyRef
3. Any

1. Hide All
2. Show All

Visibility

1. Public
2. Protected

### Instance Constructors

1.  new Variant(obj: Any)

   Creates a Variant from Object

   Creates a Variant from Object

   Since

     0.2.0

2.  new Variant(objects: Array[Any])

   Creates a Variant from array

   Creates a Variant from array

   Since

     0.2.0

3.  new Variant(list: List[AnyRef])

   Creates a Variant from Java List

   Creates a Variant from Java List

   Since

     0.2.0

4.  new Variant(seq: Seq[Any])

   Creates a Variant from Scala Seq

   Creates a Variant from Scala Seq

   Since

     0.6.0

5.  new Variant(timestamp: Timestamp)

   Creates a Variant from timestamp value

   Creates a Variant from timestamp value

   Since

     0.2.0

6.  new Variant(date: Date)

   Creates a Variant from date value

   Creates a Variant from date value

   Since

     0.2.0

7.  new Variant(time: Time)

   Creates a Variant from time value

   Creates a Variant from time value

   Since

     0.2.0

8.  new Variant(bytes: Array[Byte])

   Creates a Variant from binary value

   Creates a Variant from binary value

   Since

     0.2.0

9.  new Variant(str: String)

   Creates a Variant from String value.

   Creates a Variant from String value. By default string is parsed as Json. If the parsing failed, the string is stored as text.

   Since

     0.2.0

10.  new Variant(bool: Boolean)

    Creates a Variant from Boolean value

    Creates a Variant from Boolean value

    Since

      0.2.0

11.  new Variant(num: BigInt)

    Creates a Variant from Scala BigInt value

    Creates a Variant from Scala BigInt value

    Since

      0.6.0

12.  new Variant(num: BigInteger)

    Creates a Variant from Java BigInteger value

    Creates a Variant from Java BigInteger value

    Since

      0.2.0

13.  new Variant(num: BigDecimal)

    Creates a Variant from Scala BigDecimal value

    Creates a Variant from Scala BigDecimal value

    Since

      0.6.0

14.  new Variant(num: BigDecimal)

    Creates a Variant from Java BigDecimal value

    Creates a Variant from Java BigDecimal value

    Since

      0.2.0

15.  new Variant(num: Short)

    Creates a Variant from short integer value

    Creates a Variant from short integer value

    Since

      0.2.0

16.  new Variant(num: Int)

    Creates a Variant from integer value

    Creates a Variant from integer value

    Since

      0.2.0

17.  new Variant(num: Long)

    Creates a Variant from long integer value

    Creates a Variant from long integer value

    Since

      0.2.0

18.  new Variant(num: Float)

    Creates a Variant from float value

    Creates a Variant from float value

    Since

      0.2.0

19.  new Variant(num: Double)

    Creates a Variant from double value

    Creates a Variant from double value

    Since

      0.2.0

### 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 asArray(): Array[Variant]

   Converts the variant as Array of Variant

   Converts the variant as Array of Variant

   Since

     0.2.0

5.  def asBigDecimal(): BigDecimal

   Converts the variant as BigDecimal value

   Converts the variant as BigDecimal value

   Since

     0.6.0

6.  def asBigInt(): BigInt

   Converts the variant as Scala BigInt value

   Converts the variant as Scala BigInt value

   Since

     0.6.0

7.  def asBinary(): Array[Byte]

   Converts the variant as binary value

   Converts the variant as binary value

   Since

     0.2.0

8.  def asBoolean(): Boolean

   Converts the variant as boolean value

   Converts the variant as boolean value

   Since

     0.2.0

9.  def asDate(): Date

   Converts the variant as date value

   Converts the variant as date value

   Since

     0.2.0

10.  def asDouble(): Double

    Converts the variant as double value

    Converts the variant as double value

    Since

      0.2.0

11.  def asFloat(): Float

    Converts the variant as float value

    Converts the variant as float value

    Since

      0.2.0

12.  final def asInstanceOf[T0]: T0
    Definition Classes
      Any
13.  def asInt(): Int

    Converts the variant as integer value

    Converts the variant as integer value

    Since

      0.2.0

14.  def asJsonNode(): JsonNode

    Return the variant value as a JsonNode.

    Return the variant value as a JsonNode. This function allows to read the JSON object directly as JsonNode from variant column rather parsing it as String Example - to get the first value from array for key "a"

          val sv = new Variant("{\"a\": [1, 2], \"b\": 3, \"c\": \"xyz\"}")
          println(sv.asJsonNode().get("a").get(0))
        output
        1

    Since

      1.14.0

15.  def asJsonString(): String

    Converts the variant as valid Json String

    Converts the variant as valid Json String

    Since

      0.2.0

16.  def asLong(): Long

    Converts the variant as long value

    Converts the variant as long value

    Since

      0.2.0

17.  def asMap(): Map[String, Variant]

    Converts the variant as Scala Map of String to Variant

    Converts the variant as Scala Map of String to Variant

    Since

      0.6.0

18.  def asSeq(): Seq[Variant]

    Converts the variant as Scala Seq of Variant

    Converts the variant as Scala Seq of Variant

    Since

      0.6.0

19.  def asShort(): Short

    Converts the variant as short value

    Converts the variant as short value

    Since

      0.2.0

20.  def asString(): String

    Converts the variant as string value

    Converts the variant as string value

    Since

      0.2.0

21.  def asTime(): Time

    Converts the variant as time value

    Converts the variant as time value

    Since

      0.2.0

22.  def asTimestamp(): Timestamp

    Converts the variant as timestamp value

    Converts the variant as timestamp value

    Since

      0.2.0

23.  def clone(): AnyRef
    Attributes
      protected[lang]
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
24.  final def eq(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
25.  def equals(obj: Any): Boolean

    Checks whether two Variants are equal

    Checks whether two Variants are equal

    Definition Classes
      Variant → AnyRef → Any
    Since

      0.2.0

26.  final def getClass(): Class[_ <: AnyRef]
    Definition Classes
      AnyRef → Any
    Annotations
      @HotSpotIntrinsicCandidate() @native()
27.  def hashCode(): Int

    Calculates hashcode of this Variant

    Calculates hashcode of this Variant

    Definition Classes
      Variant → AnyRef → Any
    Since

      0.6.0

28.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
29.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
30.  final def notify(): Unit
    Definition Classes
      AnyRef
    Annotations
      @HotSpotIntrinsicCandidate() @native()
31.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
    Annotations
      @HotSpotIntrinsicCandidate() @native()
32.  final def synchronized[T0](arg0: => T0): T0
    Definition Classes
      AnyRef
33.  def toString(): String

    An alias of asString

    An alias of asString

    Definition Classes
      Variant → AnyRef → Any
    Since

      0.2.0

34.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.InterruptedException])
35.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.InterruptedException]) @native()
36.  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