-
Couldn't load subscription status.
- Fork 1.9k
[Kernel] Add snapshot construction benchmarking specification #5339
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
Open
OussamaSaoudi
wants to merge
3
commits into
delta-io:master
Choose a base branch
from
OussamaSaoudi:benchmark_p_and_m
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+130
−1
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
...ts/src/test/java/io/delta/kernel/defaults/benchmarks/models/SnapshotConstructionSpec.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| /* | ||
| * Copyright (2025) The Delta Lake Project Authors. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package io.delta.kernel.defaults.benchmarks.models; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
| import io.delta.kernel.defaults.benchmarks.workloadrunners.SnapshotConstructionRunner; | ||
| import io.delta.kernel.defaults.benchmarks.workloadrunners.WorkloadRunner; | ||
| import io.delta.kernel.engine.Engine; | ||
|
|
||
| public class SnapshotConstructionSpec extends WorkloadSpec { | ||
|
|
||
| /** The snapshot version to read. If null, the latest version will be read. From spec file. */ | ||
| @JsonProperty("version") | ||
| private Long version; | ||
|
|
||
| /** Expected data file for validating the read data result. From spec file. */ | ||
| @JsonProperty("expected_protocol_and_metadata") | ||
| private String expectedProtocolAndMetadata; | ||
|
|
||
| // Default constructor for Jackson | ||
| public SnapshotConstructionSpec() { | ||
| super("snapshot_construction"); | ||
| } | ||
|
|
||
| // Copy constructor | ||
| public SnapshotConstructionSpec( | ||
| TableInfo tableInfo, String caseName, Long version, String expectedProtocolAndMetadata) { | ||
| super("snapshot_construction"); | ||
| this.tableInfo = tableInfo; | ||
| this.version = version; | ||
| this.caseName = caseName; | ||
| this.expectedProtocolAndMetadata = expectedProtocolAndMetadata; | ||
| } | ||
|
|
||
| /** @return the snapshot version to read, or null if the latest version should be read. */ | ||
| public Long getVersion() { | ||
| return version; | ||
| } | ||
|
|
||
| @Override | ||
| public WorkloadRunner getRunner(Engine engine) { | ||
| return new SnapshotConstructionRunner(this, engine); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
.../java/io/delta/kernel/defaults/benchmarks/workloadrunners/SnapshotConstructionRunner.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| /* | ||
| * Copyright (2025) The Delta Lake Project Authors. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package io.delta.kernel.defaults.benchmarks.workloadrunners; | ||
|
|
||
| import io.delta.kernel.Snapshot; | ||
| import io.delta.kernel.SnapshotBuilder; | ||
| import io.delta.kernel.TableManager; | ||
| import io.delta.kernel.defaults.benchmarks.models.SnapshotConstructionSpec; | ||
| import io.delta.kernel.defaults.benchmarks.models.WorkloadSpec; | ||
| import io.delta.kernel.engine.Engine; | ||
| import org.openjdk.jmh.infra.Blackhole; | ||
|
|
||
| public class SnapshotConstructionRunner extends WorkloadRunner { | ||
|
|
||
| private final SnapshotConstructionSpec workloadSpec; | ||
| private final Engine engine; | ||
|
|
||
| public SnapshotConstructionRunner(SnapshotConstructionSpec spec, Engine engine) { | ||
| this.workloadSpec = spec; | ||
| this.engine = engine; | ||
| } | ||
|
|
||
| @Override | ||
| public String getName() { | ||
| return "snapshot_construction"; | ||
| } | ||
|
|
||
| @Override | ||
| public WorkloadSpec getWorkloadSpec() { | ||
| return this.workloadSpec; | ||
| } | ||
|
|
||
| @Override | ||
| public void setup() throws Exception { | ||
| /* No setup needed for snapshot construction */ | ||
| } | ||
|
|
||
| @Override | ||
| public void executeAsBenchmark(Blackhole blackhole) throws Exception { | ||
| blackhole.consume(this.execute()); | ||
| } | ||
|
|
||
| private Snapshot execute() { | ||
| String workloadTableRoot = workloadSpec.getTableInfo().getTableRoot(); | ||
| SnapshotBuilder builder = TableManager.loadSnapshot(workloadTableRoot); | ||
| if (workloadSpec.getVersion() != null) { | ||
| builder.atVersion(workloadSpec.getVersion()); | ||
| } | ||
| return builder.build(engine); | ||
| } | ||
| } | ||
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
...l-defaults/src/test/resources/workload_specs/basic_append/specs/snapshot_latest/spec.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "type": "snapshot_construction" | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should you call
snapshot.getVersion, or cast it toSnapshotImpland then call.getMetadataor.getProtocol? and maybe even print it out as a simple validation? or is that out of scope?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given this is part of the inner loop of the benchmark, I want to avoid any logging. Due to repeat runs, this can actually get quite noisy