Skip to content

Commit

Permalink
Action
Browse files Browse the repository at this point in the history
  • Loading branch information
jaceklaskowski committed Jun 2, 2024
1 parent 584af19 commit ca67e41
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions docs/Action.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,37 @@
# Action

`Action` is an [abstraction](#contract) of [operations](#implementations) that change the state of a delta table.
`Action` is an [abstraction](#contract) of [operations](#implementations) (_actions_) that change the state of a delta table.

## Contract

### <span id="json"> JSON Representation
### JSON Representation { #json }

```scala
json: String
```

Serializes (_converts_) the [(wrapped) action](#wrap) to JSON format

`json` uses [Jackson]({{ jackson.github }}) library (with [jackson-module-scala]({{ jackson.scala }})) as the JSON processor.
??? note "Jackson"
`json` uses [Jackson]({{ jackson.github }}) library (with [jackson-module-scala]({{ jackson.scala }})) as the JSON processor.

Used when:

* `OptimisticTransactionImpl` is requested to [doCommit](OptimisticTransactionImpl.md#doCommit)
* `DeltaCommand` is requested to [commitLarge](commands/DeltaCommand.md#commitLarge)

### <span id="wrap"> SingleAction Representation
### SingleAction Representation { #wrap }

```scala
wrap: SingleAction
```

Wraps the action into a [SingleAction](SingleAction.md) for serialization

See:

* [AddCDCFile](AddCDCFile.md#wrap)

Used when:

* `Snapshot` is requested to [stateReconstruction](Snapshot.md#stateReconstruction)
Expand All @@ -39,19 +44,21 @@ Used when:

Learn more in the [Scala Language Specification]({{ scala.spec }}/05-classes-and-objects.html#sealed).

* `CheckpointOnlyAction`
* [CommitInfo](CommitInfo.md)
* `DomainMetadata`
* [FileAction](FileAction.md)
* [Metadata](Metadata.md)
* [Protocol](Protocol.md)
* [SetTransaction](SetTransaction.md)

## <span id="logSchema"> Log Schema
## Log Schema { #logSchema }

```scala
logSchema: StructType
```

`logSchema` is the schema ([Spark SQL]({{ book.spark_sql }}/StructType)) of [SingleAction](SingleAction.md)s for `Snapshot` to [convert a DeltaLogFileIndex to a LogicalRelation](Snapshot.md#indexToRelation) and [emptyActions](Snapshot.md##emptyActions).
`logSchema` is the schema ([Spark SQL]({{ book.spark_sql }}/StructType)) of [SingleAction](SingleAction.md)s for `Snapshot` to [convert a DeltaLogFileIndex to a LogicalRelation](Snapshot.md#indexToRelation) and [emptyActions](Snapshot.md#emptyActions).

```scala
import org.apache.spark.sql.delta.actions.Action.logSchema
Expand Down Expand Up @@ -143,7 +150,7 @@ root
| |-- userMetadata: string (nullable = true)
```

## <span id="fromJson"> Deserializing Action (from JSON)
## Deserializing Action (from JSON) { #fromJson }

```scala
fromJson(
Expand All @@ -152,6 +159,8 @@ fromJson(

`fromJson` utility...FIXME

---

`fromJson` is used when:

* `DeltaHistoryManager` is requested for [CommitInfo of the given delta file](DeltaHistoryManager.md#getCommitInfo)
Expand Down

0 comments on commit ca67e41

Please # to comment.