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][Version Checksum] Read Protocol, Metadata, and ICT directly from the Checksum during Snapshot construction #3920

Merged
merged 7 commits into from
Dec 6, 2024

Conversation

dhruvarya-db
Copy link
Collaborator

@dhruvarya-db dhruvarya-db commented Dec 4, 2024

Which Delta project/connector is this regarding?

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

Description

Stacked over #3907.
This PR makes the Checksum (if available) the source of truth for Protocol, Metadata, ICT during snapshot construction. This helps us avoid a Spark query and improves performance.

How was this patch tested?

Added some test cases to existing suites

Does this PR introduce any user-facing changes?

No

Copy link
Collaborator

@scovich scovich left a comment

Choose a reason for hiding this comment

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

Couple nits, but code itself LGTM

Comment on lines 798 to 799
if (spark.sessionState.conf.getConf(
DeltaSQLConf.USE_PROTOCOL_AND_METADATA_FROM_CHECKSUM_ENABLED)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it useful/important to make this check conditional, where it was previously unconditional?
What is the rationale?

Copy link
Collaborator Author

@dhruvarya-db dhruvarya-db Dec 4, 2024

Choose a reason for hiding this comment

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

I thought about this again, and this does not make much sense. Removed

Comment on lines +407 to +410
log"protocol:${MDC(DeltaLogKeys.PROTOCOL, protocolStr)} " +
log"metadata:${MDC(DeltaLogKeys.DELTA_METADATA, metadataStr)}")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is the one called PROTOCOL but the other DELTA_METADATA? Why not just METADATA?

Copy link
Collaborator

Choose a reason for hiding this comment

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

update: There are already several METADATA_xxx keys, I guess this avoids ambiguity?

Comment on lines 182 to 184
// Make sure that we don't retrieve the time from the CRC.
withSQLConf(DeltaSQLConf.DELTA_WRITE_CHECKSUM_ENABLED.key -> "false") {
withTempDir { tempDir =>
Copy link
Collaborator

Choose a reason for hiding this comment

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

odd (lack of) indentation here?

(several more below)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed the indentation. I wanted to keep the diff cleaner but given that the content itself has been reviewed, that should not matter anymore

Copy link
Collaborator

@scovich scovich Dec 4, 2024

Choose a reason for hiding this comment

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

FYI - Indentation changes are easily hidden during review:
image

Copy link
Collaborator

Choose a reason for hiding this comment

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

... which gives e.g.
image

@vkorukanti vkorukanti merged commit 8fb17a0 into delta-io:master Dec 6, 2024
16 of 19 checks passed
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.

3 participants