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 3.5: Adapt DeleteFileIndexBenchmark for DVs #11529

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ public class DeleteFileIndexBenchmark {

private List<DataFile> dataFiles;

@Param({"true", "false"})
private boolean oneToOneMapping;
@Param({"partition", "file", "dv"})
private String type;

@Setup
public void setupBenchmark() throws NoSuchTableException, ParseException {
Expand All @@ -93,10 +93,12 @@ public void setupBenchmark() throws NoSuchTableException, ParseException {
}

private void initDataAndDeletes() {
if (oneToOneMapping) {
if (type.equals("partition")) {
initDataAndPartitionScopedDeletes();
} else if (type.equals("file")) {
initDataAndFileScopedDeletes();
} else {
initDataAndPartitionScopedDeletes();
initDataAndDVs();
}
}

Expand Down Expand Up @@ -183,6 +185,23 @@ private void initDataAndFileScopedDeletes() {
}
}

private void initDataAndDVs() {
for (int partitionOrdinal = 0; partitionOrdinal < NUM_PARTITIONS; partitionOrdinal++) {
StructLike partition = TestHelpers.Row.of(partitionOrdinal);

RowDelta rowDelta = table.newRowDelta();

for (int fileOrdinal = 0; fileOrdinal < NUM_DATA_FILES_PER_PARTITION; fileOrdinal++) {
DataFile dataFile = FileGenerationUtil.generateDataFile(table, partition);
DeleteFile dv = FileGenerationUtil.generateDV(table, dataFile);
rowDelta.addRows(dataFile);
rowDelta.addDeletes(dv);
}

rowDelta.commit();
}
}

private void setupSpark() {
this.spark =
SparkSession.builder()
Expand Down Expand Up @@ -240,7 +259,7 @@ private void initTable() throws NoSuchTableException, ParseException {
TableProperties.DELETE_MODE,
RowLevelOperationMode.MERGE_ON_READ.modeName(),
TableProperties.FORMAT_VERSION,
2);
type.equals("dv") ? 3 : 2);

this.table = Spark3Util.loadIcebergTable(spark, TABLE_NAME);
}
Expand Down