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

# TypedAsyncJob

###

#### class TypedAsyncJob[T] extends AsyncJob

Provides a way to track an asynchronously executed action in a DataFrame.

To get the result of the action (e.g. the number of results from a `count()` action or an Array of Row objects from the `collect()` action), call the getResult method.

To perform an action on a DataFrame asynchronously, call an action method on the DataFrameAsyncActor object returned by DataFrame.async. For example:

    val asyncJob1 = df.async.collect()
    val asyncJob2 = df.async.toLocalIterator()
    val asyncJob3 = df.async.count()

Each of these methods returns a TypedAsyncJob object that you can use to get the results of the action.

Since

  0.11.0

Linear Supertypes
AsyncJob, AnyRef, Any
Known Subclasses
MergeTypedAsyncJob

Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. TypedAsyncJob
2. AsyncJob
3. AnyRef
4. 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.  final def asInstanceOf[T0]: T0
   Definition Classes
     Any
5.  def cancel(): Unit

   Cancel the underlying query if it is running.

   Cancel the underlying query if it is running.

   Definition Classes
     AsyncJob
   Since

     0.11.0

6.  def clone(): AnyRef
   Attributes
     protected[lang]
   Definition Classes
     AnyRef
   Annotations
     @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
7.  final def eq(arg0: AnyRef): Boolean
   Definition Classes
     AnyRef
8.  def equals(arg0: AnyRef): Boolean
   Definition Classes
     AnyRef → Any
9.  final def getClass(): Class[_ <: AnyRef]
   Definition Classes
     AnyRef → Any
   Annotations
     @HotSpotIntrinsicCandidate() @native()
10.  def getIterator(maxWaitTimeInSeconds: Int = session.requestTimeoutInSeconds): Iterator[Row]

    Returns an iterator of Row objects that you can use to retrieve the results for the underlying query.

    Returns an iterator of Row objects that you can use to retrieve the results for the underlying query.

    Unlike the getRows method, this method does not load all data into memory at once.

    maxWaitTimeInSeconds

      The maximum number of seconds to wait for the query to complete before attempting to retrieve the results. The default value is the value of the `snowpark_request_timeout_in_seconds` configuration property.

    returns

      An Iterator of Row objects

    Definition Classes
      AsyncJob
    Since

      0.11.0

11.  def getQueryId(): String

    Get the query ID for the underlying query.

    Get the query ID for the underlying query.

    returns

      a query ID

    Definition Classes
      AsyncJob
    Since

      0.11.0

12.  def getResult(maxWaitTimeInSeconds: Int = session.requestTimeoutInSeconds): T

    Returns the result for the specific DataFrame action.

    Returns the result for the specific DataFrame action.

    Example 1: Create a TypedAsyncJob by asynchronously executing a DataFrame action `collect()`, check whether the job is running or not, and get the action result with getResult. NOTE: The returned type for getResult in this example is `Array[Row]`.

        val df = session.table("t1")
        val asyncJob = df.async.collect()
        println(s"Is query ${asyncJob.getQueryId()} running? ${asyncJob.isRunning()}")
        val rowResult = asyncJob.getResult()

    Example 2: Create a TypedAsyncJob by asynchronously executing a DataFrame action count() and get the action result with getResult. NOTE: The returned type for getResult in this example is `Long`.

        val asyncJob = df.async.count()
        val longResult = asyncJob.getResult()

    maxWaitTimeInSeconds

      The maximum number of seconds to wait for the query to complete before attempting to retrieve the results. The default value is the value of the `snowpark_request_timeout_in_seconds` configuration property.

    returns

      The result for the specific action

    Since

      0.11.0

13.  def getRows(maxWaitTimeInSeconds: Int = session.requestTimeoutInSeconds): Array[Row]

    Returns an Array of Row objects that represent the results of the underlying query.

    Returns an Array of Row objects that represent the results of the underlying query.

    maxWaitTimeInSeconds

      The maximum number of seconds to wait for the query to complete before attempting to retrieve the results. The default value is the value of the `snowpark_request_timeout_in_seconds` configuration property.

    returns

      An Array of Row objects

    Definition Classes
      AsyncJob
    Since

      0.11.0

14.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
    Annotations
      @HotSpotIntrinsicCandidate() @native()
15.  def isDone(): Boolean

    Returns true if the underlying query completed.

    Returns true if the underlying query completed.

    Completion may be due to query success, cancellation or failure, in all of these cases, this method will return true.

    returns

      true if this query completed.

    Definition Classes
      AsyncJob
    Since

      0.11.0

16.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
17.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
18.  final def notify(): Unit
    Definition Classes
      AnyRef
    Annotations
      @HotSpotIntrinsicCandidate() @native()
19.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
    Annotations
      @HotSpotIntrinsicCandidate() @native()
20.  final def synchronized[T0](arg0: => T0): T0
    Definition Classes
      AnyRef
21.  def toString(): String
    Definition Classes
      AnyRef → Any
22.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.InterruptedException])
23.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.InterruptedException]) @native()
24.  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 AsyncJob

### Inherited from AnyRef

### Inherited from Any

### Ungrouped