Action

Action is an abstraction of metadata of a change to (the state of) a Delta table.

Action can be converted (serialized) to json format for…​FIXME

Action object defines logSchema that is a schema (StructType) based on the SingleAction case class.

import org.apache.spark.sql.delta.actions.Action.logSchema
scala> logSchema.printTreeString
root
 |-- txn: struct (nullable = true)
 |    |-- appId: string (nullable = true)
 |    |-- version: long (nullable = false)
 |    |-- lastUpdated: long (nullable = true)
 |-- add: struct (nullable = true)
 |    |-- path: string (nullable = true)
 |    |-- partitionValues: map (nullable = true)
 |    |    |-- key: string
 |    |    |-- value: string (valueContainsNull = true)
 |    |-- size: long (nullable = false)
 |    |-- modificationTime: long (nullable = false)
 |    |-- dataChange: boolean (nullable = false)
 |    |-- stats: string (nullable = true)
 |    |-- tags: map (nullable = true)
 |    |    |-- key: string
 |    |    |-- value: string (valueContainsNull = true)
 |-- remove: struct (nullable = true)
 |    |-- path: string (nullable = true)
 |    |-- deletionTimestamp: long (nullable = true)
 |    |-- dataChange: boolean (nullable = false)
 |-- metaData: struct (nullable = true)
 |    |-- id: string (nullable = true)
 |    |-- name: string (nullable = true)
 |    |-- description: string (nullable = true)
 |    |-- format: struct (nullable = true)
 |    |    |-- provider: string (nullable = true)
 |    |    |-- options: map (nullable = true)
 |    |    |    |-- key: string
 |    |    |    |-- value: string (valueContainsNull = true)
 |    |-- schemaString: string (nullable = true)
 |    |-- partitionColumns: array (nullable = true)
 |    |    |-- element: string (containsNull = true)
 |    |-- configuration: map (nullable = true)
 |    |    |-- key: string
 |    |    |-- value: string (valueContainsNull = true)
 |    |-- createdTime: long (nullable = true)
 |-- protocol: struct (nullable = true)
 |    |-- minReaderVersion: integer (nullable = false)
 |    |-- minWriterVersion: integer (nullable = false)
 |-- commitInfo: struct (nullable = true)
 |    |-- version: long (nullable = true)
 |    |-- timestamp: timestamp (nullable = true)
 |    |-- userId: string (nullable = true)
 |    |-- userName: string (nullable = true)
 |    |-- operation: string (nullable = true)
 |    |-- operationParameters: map (nullable = true)
 |    |    |-- key: string
 |    |    |-- value: string (valueContainsNull = true)
 |    |-- job: struct (nullable = true)
 |    |    |-- jobId: string (nullable = true)
 |    |    |-- jobName: string (nullable = true)
 |    |    |-- runId: string (nullable = true)
 |    |    |-- jobOwnerId: string (nullable = true)
 |    |    |-- triggerType: string (nullable = true)
 |    |-- notebook: struct (nullable = true)
 |    |    |-- notebookId: string (nullable = true)
 |    |-- clusterId: string (nullable = true)
 |    |-- readVersion: long (nullable = true)
 |    |-- isolationLevel: string (nullable = true)
 |    |-- isBlindAppend: boolean (nullable = true)
Table 1. Action Contract (Abstract Methods Only)
Method Description

wrap

wrap: SingleAction

Wraps the action into a SingleAction for serialization

Used when:

Table 2. Actions (Direct Implementations and Extensions Only)
Action Description

CommitInfo

FileAction

Metadata

Protocol

SetTransaction

Action is a Scala sealed trait which means that all the implementations are in the same compilation unit (a single file).

Serializing to JSON Format — json Method

json: String

json simply serializes (converts) the (wrapped) action to JSON format.

json uses Jackson library (with jackson-module-scala) as the JSON processor.

json is used when:

  • OptimisticTransactionImpl is requested to doCommit

  • ConvertToDeltaCommand is requested to streamWrite

Deserializing Action (From JSON Format) — fromJson Utility

fromJson(
  json: String): Action

fromJson…​FIXME

fromJson is used when: