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] Support for reading log compactions #2073

Closed

Conversation

prakharjain09
Copy link
Collaborator

@prakharjain09 prakharjain09 commented Sep 18, 2023

Which Delta project/connector is this regarding?

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

Description

This PR adds read support for log compactions described here: #2072

How was this patch tested?

UTs

Does this PR introduce any user-facing changes?

No

Comment on lines 117 to 123
case DeltaFile(f, fileVersion) =>
(f, FileType.DELTA, fileVersion)
case CompactedDeltaFile(f, startVersion, endVersion)
if includeMinorCompactions && versionToLoad.forall(endVersion <= _) =>
(f, FileType.COMPACTED_DELTA, startVersion)
case CheckpointFile(f, fileVersion) if f.getLen > 0 =>
(f, FileType.CHECKPOINT, fileVersion)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't see any use of the middle element of this triple? The version is used for takeWhile and the file status is what we actually return... but where is file type used?

(version, version)
}

if (highestVersionSeen < startVersion && endVersion <= latestCommitVersion) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This ensures we don't pick up overlapping compacted Deltas, right?

  • First compaction can't straddle the starting version
  • Neighboring compactions can't overlap
  • Last compaction can't straddle latest version

We get a lot of work out of that one line, maybe worth a code comment?

Comment on lines +389 to +392
if (Utils.isTesting) {
assert(false, s"Validation around Compacted deltas failed while creating Snapshot. " +
s"[${JsonUtils.toJson(eventData)}]")
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does this code do? It seems to fail unconditionally in testing, but it's not obvious why validation has failed at this point?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

adding comment before the val eventData.

@prakharjain09 prakharjain09 changed the title [LogCompaction] Support for reading log compactions [Spark] Support for reading log compactions Sep 29, 2023
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.

Nice!

@vkorukanti vkorukanti closed this in 0e05caf Oct 2, 2023
vkorukanti pushed a commit to vkorukanti/delta that referenced this pull request Oct 3, 2023
This PR adds read support for log compactions described here: delta-io#2072

Closes delta-io#2073

GitOrigin-RevId: 6f4a09c3fa09c303cdeb747c382cedcfda5a2a4c
vkorukanti pushed a commit to vkorukanti/delta that referenced this pull request Oct 3, 2023
This PR adds read support for log compactions described here: delta-io#2072

Closes delta-io#2073

GitOrigin-RevId: 6f4a09c3fa09c303cdeb747c382cedcfda5a2a4c
Kimahriman pushed a commit to Kimahriman/delta that referenced this pull request Oct 3, 2023
This PR adds read support for log compactions described here: delta-io#2072

Closes delta-io#2073

GitOrigin-RevId: 6f4a09c3fa09c303cdeb747c382cedcfda5a2a4c
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.

2 participants