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

Core, Spark: Rewrite data files with high delete ratio #11825

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nastra
Copy link
Contributor

@nastra nastra commented Dec 19, 2024

No description provided.

Comment on lines +104 to +105
double deletedRecords = (double) Math.min(file.recordCount(), task.file().recordCount());
double deleteRatio = deletedRecords / task.file().recordCount();
Copy link
Contributor

Choose a reason for hiding this comment

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

[question] wondering if adjusting deleteRecords by taking a min is the right thing for SplitScanTask ? as the recordCount is records in data files.

my understanding was that delete ratio can be always:

file.recordCount() / task.file().recordCount()

IIUC, the following is Maths for this :

long[] splitOffsets = splitOffsets(file);
long splitOffset = splitOffsets != null ? splitOffsets[0] : 0L;
// meaning this fileScan task contains only scannedFileFraction of the file in it
double scannedFileFraction = ((double) length) / (file.fileSizeInBytes() - splitOffset);
// number of deletes associated with this based on uniform distribution of deletes across the splitScan task
long deletedRecords = (scannedFileFraction * deleteFile.recordCount()) ;
long totalRecordWithoutDeletes = (scannedFileFraction * file.recordCount());
double deleteRatio = deletedRecords / totalRecordWithoutDeletes
deleteRatio = (scannedFileFraction * deleteFile.recordCount()) / (scannedFileFraction * file.recordCount())
deleteRatio = (scannedFileFraction * deleteFile.recordCount()) / (scannedFileFraction * file.recordCount())
deleteRatio = deleteFile.recordCount() / file.recordCount()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was planning on re-visiting the calculation after the holiday break (sorry forgot to put the PR up as a draft)

Copy link
Contributor

Choose a reason for hiding this comment

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

No worries, Happy Holidays @nastra !

@nastra nastra marked this pull request as draft December 20, 2024 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants