Skip to content

Commit 7442ebf

Browse files
dhruvarya-dballisonport-db
authored andcommitted
Add support for writing V2 Checkpoints
Adds capability to write V2 Checkpoints. This PR only adds write support. More Unit Tests to follow in an upcoming PR which will add read support. Closes #2031 GitOrigin-RevId: c3a889b8f67829ec48f6ff650d4d77b75531288f
1 parent 201e89b commit 7442ebf

File tree

7 files changed

+506
-53
lines changed

7 files changed

+506
-53
lines changed

spark/src/main/scala/org/apache/spark/sql/delta/CheckpointProvider.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package org.apache.spark.sql.delta
1818

19+
import org.apache.spark.sql.delta.actions.Protocol
1920
import org.apache.spark.sql.delta.metering.DeltaLogging
2021
import org.apache.spark.sql.delta.sources.DeltaSQLConf
2122
import org.apache.spark.sql.delta.util.FileNames._
@@ -59,6 +60,19 @@ trait CheckpointProvider extends UninitializedCheckpointProvider {
5960
def allActionsFileIndexes(): Seq[DeltaLogFileIndex]
6061
}
6162

63+
object CheckpointProvider extends DeltaLogging {
64+
65+
private[delta] def isV2CheckpointEnabled(protocol: Protocol): Boolean =
66+
protocol.isFeatureSupported(V2CheckpointTableFeature)
67+
68+
/**
69+
* Returns whether V2 Checkpoints are enabled or not.
70+
* This means an underlying checkpoint in this table could be a V2Checkpoint with sidecar files.
71+
*/
72+
def isV2CheckpointEnabled(snapshotDescriptor: SnapshotDescriptor): Boolean =
73+
isV2CheckpointEnabled(snapshotDescriptor.protocol)
74+
}
75+
6276
/**
6377
* An implementation of [[CheckpointProvider]] where the information about checkpoint files
6478
* (i.e. Seq[FileStatus]) is already known in advance.

0 commit comments

Comments
 (0)