Class/Object

org.apache.spark.sql.delta

OptimisticTransaction

Related Docs: object OptimisticTransaction | package delta

Permalink

class OptimisticTransaction extends OptimisticTransactionImpl with DeltaLogging

Used to perform a set of reads in a transaction and then commit a set of updates to the state of the log. All reads from the DeltaLog, MUST go through this instance rather than directly to the DeltaLog otherwise they will not be check for logical conflicts with concurrent updates.

This class is not thread-safe.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. OptimisticTransaction
  2. OptimisticTransactionImpl
  3. TransactionalWrite
  4. DeltaLogging
  5. DatabricksLogging
  6. DeltaProgressReporter
  7. Logging
  8. AnyRef
  9. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new OptimisticTransaction(deltaLog: DeltaLog)(implicit clock: Clock)

    Permalink

    Creates a new OptimisticTransaction.

    Creates a new OptimisticTransaction.

    deltaLog

    The Delta Log for the table this transaction is modifying.

  2. new OptimisticTransaction(deltaLog: DeltaLog, snapshot: Snapshot)(implicit clock: Clock)

    Permalink

    deltaLog

    The Delta Log for the table this transaction is modifying.

    snapshot

    The snapshot that this transaction is reading at.

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. val _spark: SparkSession

    Permalink
    Attributes
    protected
    Definition Classes
    OptimisticTransactionImpl
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def checkAndRetry(checkVersion: Long, actions: Seq[Action], attemptNumber: Int): Long

    Permalink

    Looks at actions that have happened since the txn started and checks for logical conflicts with the read/writes.

    Looks at actions that have happened since the txn started and checks for logical conflicts with the read/writes. If no conflicts are found, try to commit again otherwise, throw an exception.

    Attributes
    protected
    Definition Classes
    OptimisticTransactionImpl
  7. implicit val clock: Clock

    Permalink
  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def commit(actions: Seq[Action], op: Operation): Long

    Permalink

    Modifies the state of the log by adding a new commit that is based on a read at the given lastVersion.

    Modifies the state of the log by adding a new commit that is based on a read at the given lastVersion. In the case of a conflict with a concurrent writer this method will throw an exception.

    actions

    Set of actions to commit

    op

    Details of operation that is performing this transactional commit

    Definition Classes
    OptimisticTransactionImpl
    Annotations
    @throws( ... )
  10. var commitInfo: CommitInfo

    Permalink
    Attributes
    protected
    Definition Classes
    OptimisticTransactionImpl
  11. var commitStartNano: Long

    Permalink
    Attributes
    protected
    Definition Classes
    OptimisticTransactionImpl
  12. var committed: Boolean

    Permalink

    Tracks if this transaction has already committed.

    Tracks if this transaction has already committed.

    Attributes
    protected
    Definition Classes
    OptimisticTransactionImpl
  13. val deltaLog: DeltaLog

    Permalink

    The Delta Log for the table this transaction is modifying.

    The Delta Log for the table this transaction is modifying.

    Definition Classes
    OptimisticTransactionOptimisticTransactionImplTransactionalWrite
  14. var dependsOnFiles: Boolean

    Permalink

    Tracks if this transaction depends on any data files.

    Tracks if this transaction depends on any data files. This flag must be set if this transaction reads any data explicitly or implicitly (e.g., delete, update and overwrite).

    Attributes
    protected
    Definition Classes
    OptimisticTransactionImpl
  15. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  17. def filterFiles(filters: Seq[Expression]): Seq[AddFile]

    Permalink

    Returns files matching the given predicates.

    Returns files matching the given predicates.

    Definition Classes
    OptimisticTransactionImpl
  18. def filterFiles(): Seq[AddFile]

    Permalink

    Returns files matching the given predicates.

    Returns files matching the given predicates.

    Definition Classes
    OptimisticTransactionImpl
  19. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  20. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  21. def getCommitter(outputPath: Path): DelayedCommitProtocol

    Permalink
    Attributes
    protected
    Definition Classes
    TransactionalWrite
  22. def getPartitioningColumns(partitionSchema: StructType, output: Seq[Attribute], colsDropped: Boolean): Seq[Attribute]

    Permalink
    Attributes
    protected
    Definition Classes
    TransactionalWrite
  23. var hasWritten: Boolean

    Permalink
    Attributes
    protected
    Definition Classes
    TransactionalWrite
  24. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  25. def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean): Boolean

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  26. def initializeLogIfNecessary(isInterpreter: Boolean): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  27. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  28. def isTraceEnabled(): Boolean

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  29. def log: Logger

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  30. def logConsole(line: String): Unit

    Permalink
    Definition Classes
    DatabricksLogging
  31. def logDebug(msg: ⇒ String, throwable: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  32. def logDebug(msg: ⇒ String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  33. def logError(msg: ⇒ String, throwable: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  34. def logError(msg: ⇒ String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  35. def logInfo(msg: ⇒ String, throwable: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  36. def logInfo(msg: ⇒ String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  37. def logName: String

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  38. def logTrace(msg: ⇒ String, throwable: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  39. def logTrace(msg: ⇒ String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  40. def logWarning(msg: ⇒ String, throwable: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  41. def logWarning(msg: ⇒ String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  42. def makeOutputNullable(output: Seq[Attribute]): Seq[Attribute]

    Permalink

    Makes the output attributes nullable, so that we don't write unreadable parquet files.

    Makes the output attributes nullable, so that we don't write unreadable parquet files.

    Attributes
    protected
    Definition Classes
    TransactionalWrite
  43. def metadata: Metadata

    Permalink

    Returns the metadata at the current point in the log.

    Returns the metadata at the current point in the log.

    Definition Classes
    OptimisticTransactionImplTransactionalWrite
  44. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  45. var newMetadata: Option[Metadata]

    Permalink

    Stores the updated metadata (if any) that will result from this txn.

    Stores the updated metadata (if any) that will result from this txn.

    Attributes
    protected
    Definition Classes
    OptimisticTransactionImpl
  46. def normalizeData(data: Dataset[_], partitionCols: Seq[String]): (QueryExecution, Seq[Attribute])

    Permalink

    Normalize the schema of the query, and return the QueryExecution to execute.

    Normalize the schema of the query, and return the QueryExecution to execute. The output attributes of the QueryExecution may not match the attributes we return as the output schema. This is because streaming queries create IncrementalExecution, which cannot be further modified. We can however have the Parquet writer use the physical plan from IncrementalExecution and the output schema provided through the attributes.

    Attributes
    protected
    Definition Classes
    TransactionalWrite
  47. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  48. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  49. def postCommit(commitVersion: Long, commitActions: Seq[Action]): Unit

    Permalink

    Perform post-commit operations

    Perform post-commit operations

    Attributes
    protected
    Definition Classes
    OptimisticTransactionImpl
  50. def prepareCommit(actions: Seq[Action], op: Operation): Seq[Action]

    Permalink

    Prepare for a commit by doing all necessary pre-commit checks and modifications to the actions.

    Prepare for a commit by doing all necessary pre-commit checks and modifications to the actions.

    returns

    The finalized set of actions.

    Attributes
    protected
    Definition Classes
    OptimisticTransactionImpl
  51. val protocol: Protocol

    Permalink

    The protocol of the snapshot that this transaction is reading at.

    The protocol of the snapshot that this transaction is reading at.

    Definition Classes
    OptimisticTransactionImplTransactionalWrite
  52. val readTxn: ArrayBuffer[String]

    Permalink

    Tracks the appIds that have been seen by this transaction.

    Tracks the appIds that have been seen by this transaction.

    Attributes
    protected
    Definition Classes
    OptimisticTransactionImpl
  53. def readVersion: Long

    Permalink

    The version that this transaction is reading from.

    The version that this transaction is reading from.

    Definition Classes
    OptimisticTransactionImpl
  54. def readWholeTable(): Unit

    Permalink

    Mark the entire table as tainted by this transaction.

    Mark the entire table as tainted by this transaction.

    Definition Classes
    OptimisticTransactionImpl
  55. def recordDeltaEvent(deltaLog: DeltaLog, opType: String, tags: Map[TagDefinition, String] = Map.empty, data: AnyRef = null): Unit

    Permalink

    Used to record the occurrence of a single event or report detailed, operation specific statistics.

    Used to record the occurrence of a single event or report detailed, operation specific statistics.

    Attributes
    protected
    Definition Classes
    DeltaLogging
  56. def recordDeltaOperation[A](deltaLog: DeltaLog, opType: String, tags: Map[TagDefinition, String] = Map.empty)(thunk: ⇒ A): A

    Permalink

    Used to report the duration as well as the success or failure of an operation.

    Used to report the duration as well as the success or failure of an operation.

    Attributes
    protected
    Definition Classes
    DeltaLogging
  57. def recordEvent(metric: MetricDefinition, additionalTags: Map[TagDefinition, String] = Map.empty, blob: String = null, trimBlob: Boolean = true): Unit

    Permalink
    Definition Classes
    DatabricksLogging
  58. def recordOperation[S](opType: OpType, opTarget: String = null, extraTags: Map[TagDefinition, String], isSynchronous: Boolean = true, alwaysRecordStats: Boolean = false, allowAuthTags: Boolean = false, killJvmIfStuck: Boolean = false, outputMetric: MetricDefinition = null, silent: Boolean = true)(thunk: ⇒ S): S

    Permalink
    Definition Classes
    DatabricksLogging
  59. def recordUsage(metric: MetricDefinition, quantity: Double, additionalTags: Map[TagDefinition, String] = Map.empty, blob: String = null, forceSample: Boolean = false, trimBlob: Boolean = true, silent: Boolean = false): Unit

    Permalink
    Definition Classes
    DatabricksLogging
  60. val snapshot: Snapshot

    Permalink

    The snapshot that this transaction is reading at.

    The snapshot that this transaction is reading at.

    Definition Classes
    OptimisticTransactionOptimisticTransactionImplTransactionalWrite
  61. val snapshotMetadata: Metadata

    Permalink

    For new tables, fetch global configs as metadata.

    For new tables, fetch global configs as metadata.

    Definition Classes
    OptimisticTransactionImpl
  62. def spark: SparkSession

    Permalink
    Attributes
    protected
    Definition Classes
    OptimisticTransactionImpl
  63. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  64. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  65. val txnStartNano: Long

    Permalink
    Attributes
    protected
    Definition Classes
    OptimisticTransactionImpl
  66. def txnVersion(id: String): Long

    Permalink

    Returns the latest version that has committed for the idempotent transaction with given id.

    Returns the latest version that has committed for the idempotent transaction with given id.

    Definition Classes
    OptimisticTransactionImpl
  67. def updateMetadata(metadata: Metadata): Unit

    Permalink

    Records an update to the metadata that should be committed with this transaction.

    Records an update to the metadata that should be committed with this transaction. Note that this must be done before writing out any files so that file writing and checks happen with the final metadata for the table.

    IMPORTANT: It is the responsibility of the caller to ensure that files currently present in the table are still valid under the new metadata.

    Definition Classes
    OptimisticTransactionImpl
  68. def verifyNewMetadata(metadata: Metadata): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    OptimisticTransactionImpl
  69. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  70. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  71. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  72. def withStatusCode[T](statusCode: String, defaultMessage: String, data: Map[String, Any] = Map.empty)(body: ⇒ T): T

    Permalink

    Report a log to indicate some command is running.

    Report a log to indicate some command is running.

    Definition Classes
    DeltaProgressReporter
  73. def writeFiles(data: Dataset[_], writeOptions: Option[DeltaOptions], isOptimize: Boolean): Seq[AddFile]

    Permalink

    Writes out the dataframe after performing schema validation.

    Writes out the dataframe after performing schema validation. Returns a list of actions to append these files to the reservoir.

    Definition Classes
    TransactionalWrite
  74. def writeFiles(data: Dataset[_], isOptimize: Boolean): Seq[AddFile]

    Permalink
    Definition Classes
    TransactionalWrite
  75. def writeFiles(data: Dataset[_], writeOptions: Option[DeltaOptions]): Seq[AddFile]

    Permalink
    Definition Classes
    TransactionalWrite
  76. def writeFiles(data: Dataset[_]): Seq[AddFile]

    Permalink
    Definition Classes
    TransactionalWrite

Inherited from OptimisticTransactionImpl

Inherited from TransactionalWrite

Inherited from DeltaLogging

Inherited from DatabricksLogging

Inherited from DeltaProgressReporter

Inherited from Logging

Inherited from AnyRef

Inherited from Any

Ungrouped