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] Implement distributed orphan file clean for spark #4207

Merged
merged 5 commits into from
Sep 19, 2024

Conversation

ulysses-you
Copy link
Contributor

Purpose

This pr supports distributed orphan file clean for spark using Dataset interface.

Tests

add test

API and Format

no

Documentation

@xuzifu666
Copy link
Contributor

@ulysses-you reopen this pr plz, we can review it continue.

@ulysses-you ulysses-you reopened this Sep 19, 2024
@xuzifu666
Copy link
Contributor

+1,nice.

collectWithoutDataFile(branch, snapshot, usedFileConsumer, manifestConsumer)
usedFileBuffer
}
.toDS()
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we cache this DS to avoid computing twice?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed

}
val manifestConsumer = new Consumer[ManifestFileMeta] {
override def accept(t: ManifestFileMeta): Unit = {
isManifestMetaFile = true
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks very weird, and this protocol may be break.

Can you just refactor collectWithoutDataFile to pass only one Consumer<Pair<String, Boolean>>, file and isManifestFile.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree, changed to use Consumer<Pair<String, Boolean>>

@JingsongLi
Copy link
Contributor

Please add close #4184 in comment too.

@@ -104,7 +104,7 @@ class RemoveOrphanFilesProcedureTest extends PaimonSparkTestBase {
checkAnswer(
spark.sql(
s"CALL sys.remove_orphan_files(table => 'T', older_than => '$older_than', dry_run => true)"),
Row(orphanFile1.toUri.getPath) :: Row(orphanFile2.toUri.getPath) :: Nil
Row(2) :: Nil
Copy link
Contributor

@xuzifu666 xuzifu666 Sep 19, 2024

Choose a reason for hiding this comment

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

Maybe need add a test line for each case at end with 'checkAnswer(spark.sql(s"CALL sys.remove_orphan_files(table => 'T')"), Row(0) :: Nil)' to comfire no orphan files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added tests

Copy link
Contributor

@JingsongLi JingsongLi left a comment

Choose a reason for hiding this comment

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

+1

@JingsongLi JingsongLi merged commit 12d6db5 into apache:master Sep 19, 2024
9 of 10 checks passed
@ulysses-you ulysses-you deleted the orphan branch September 20, 2024 00:48
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