Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Spark] Introduce V2 Checkpoint actions, table feature #1983

Closed
wants to merge 2 commits into from

Conversation

prakharjain09
Copy link
Collaborator

@prakharjain09 prakharjain09 commented Aug 17, 2023

Which Delta project/connector is this regarding?

  • Spark
  • Standalone
  • Flink
  • Kernel
  • Other (fill in here)

Description

Introduces actions for V2 Checkpoints - checkpointMetadata, sidecarFiles. Also introduces TableFeature for V2 Checkpoints.
Currently the feature is named with suffix -under-development. It will be removed in a later PR when all other pieces are merged.

Part of #1793 .

How was this patch tested?

UTs

Does this PR introduce any user-facing changes?

No

Copy link
Collaborator

@ryan-johnson-databricks ryan-johnson-databricks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a few nits


/** Converts a `name` String into a [[Policy]] */
def fromName(name: String): Policy = ALL.find(_.name == name).getOrElse {
throw new IllegalStateException(s"Invalid policy $name")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason it's IllegalState instead of IllegalArgument?

Copy link
Collaborator Author

@prakharjain09 prakharjain09 Aug 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IllegalArgument suits better - fixing this.

Comment on lines +631 to +632
fromString = str => CheckpointPolicy.fromName(str),
validationFunction = (v => CheckpointPolicy.ALL.exists(_.name == v.name)),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we care that it's case sensitive?
(I'm fine either way, just checking that it's intentional)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think most of the other table properties don't handle lower/upper case - following the same pattern.

Comment on lines 349 to 351
DeltaUtils.isTesting || SparkSession.getActiveSession.map { spark =>
spark.conf.get(DeltaSQLConf.EXPOSE_CHECKPOINT_V2_TABLE_FEATURE_FOR_TESTING)
}.getOrElse(false)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: simpler?

Suggested change
DeltaUtils.isTesting || SparkSession.getActiveSession.map { spark =>
spark.conf.get(DeltaSQLConf.EXPOSE_CHECKPOINT_V2_TABLE_FEATURE_FOR_TESTING)
}.getOrElse(false)
DeltaUtils.isTesting || SparkSession.getActiveSession.exists { spark =>
spark.conf.get(DeltaSQLConf.EXPOSE_CHECKPOINT_V2_TABLE_FEATURE_FOR_TESTING)
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could also do

Suggested change
DeltaUtils.isTesting || SparkSession.getActiveSession.map { spark =>
spark.conf.get(DeltaSQLConf.EXPOSE_CHECKPOINT_V2_TABLE_FEATURE_FOR_TESTING)
}.getOrElse(false)
SparkSession.getActiveSession.map { spark =>
spark.conf.get(DeltaSQLConf.EXPOSE_CHECKPOINT_V2_TABLE_FEATURE_FOR_TESTING)
}.getOrElse(DeltaUtils.isTesting)

Comment on lines 1227 to 1229
val tagMapWithSchema = sidecarFileSchemaOpt
.map(schema => Map(Tags.SIDECAR_FILE_SCHEMA.name -> schema.json))
.getOrElse(Map.empty)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
val tagMapWithSchema = sidecarFileSchemaOpt
.map(schema => Map(Tags.SIDECAR_FILE_SCHEMA.name -> schema.json))
.getOrElse(Map.empty)
val tagMapWithSchema = sidecarFileSchemaOpt.map(Tags.SIDECAR_FILE_SCHEMA.name -> _.json)

(Map.++ below accepts anything that resembles TraversibleOnce)

.checkValues(Set("json", "parquet"))
.createOptional

val EXPOSE_CHECKPOINT_V2_TABLE_FEATURE_FOR_TESTING =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is temporary, to be removed once the feature is ready for general use?

@tdas
Copy link
Contributor

tdas commented Aug 25, 2023

LGTM.

vkorukanti pushed a commit to vkorukanti/delta that referenced this pull request Sep 6, 2023
This PR introduces actions and placeholder TableFeature for V2 Checkpoints.

Closes [delta-io#1983](delta-io#1983)

GitOrigin-RevId: fd41917ea6b21701defe422ef643fd0ff59e125f
@vkorukanti
Copy link
Collaborator

Merged as 22ade20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants