Skip to content

Commit

Permalink
[Kernel] Minor refactor -- add missing getters to CommitInfo + add no…
Browse files Browse the repository at this point in the history
…n-null checks to constructor (delta-io#4194)

<!--
Thanks for sending a pull request!  Here are some tips for you:
1. If this is your first time, please read our contributor guidelines:
https://github.com/delta-io/delta/blob/master/CONTRIBUTING.md
2. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP]
Your PR title ...'.
  3. Be sure to keep the PR description updated to reflect all changes.
  4. Please write your PR title to summarize what this PR proposes.
5. If possible, provide a concise example to reproduce the issue for a
faster review.
6. If applicable, include the corresponding issue number in the PR title
and link it in the body.
-->

#### Which Delta project/connector is this regarding?
<!--
Please add the component selected below to the beginning of the pull
request title
For example: [Spark] Title of my pull request
-->

- [ ] Spark
- [ ] Standalone
- [ ] Flink
- [x] Kernel
- [ ] Other (fill in here)

## Description

Add missing getters + requireNonNull checks.

## How was this patch tested?

Existing tests suffice.

## Does this PR introduce _any_ user-facing changes?

No
  • Loading branch information
allisonport-db authored Feb 27, 2025
1 parent 9d422c4 commit 4a61561
Showing 1 changed file with 31 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import static io.delta.kernel.internal.DeltaErrors.wrapEngineExceptionThrowsIO;
import static io.delta.kernel.internal.util.Utils.singletonCloseableIterator;
import static io.delta.kernel.internal.util.VectorUtils.stringStringMapValue;
import static java.util.Objects.requireNonNull;
import static java.util.stream.Collectors.toMap;

import io.delta.kernel.data.ColumnVector;
Expand Down Expand Up @@ -125,22 +126,14 @@ public CommitInfo(
boolean isBlindAppend,
String txnId,
Map<String, String> operationMetrics) {
this.inCommitTimestamp = inCommitTimestamp;
this.inCommitTimestamp = requireNonNull(inCommitTimestamp);
this.timestamp = timestamp;
this.engineInfo = engineInfo;
this.operation = operation;
this.operationParameters = Collections.unmodifiableMap(operationParameters);
this.engineInfo = requireNonNull(engineInfo);
this.operation = requireNonNull(operation);
this.operationParameters = Collections.unmodifiableMap(requireNonNull(operationParameters));
this.isBlindAppend = isBlindAppend;
this.txnId = txnId;
this.operationMetrics = operationMetrics;
}

public Optional<Long> getInCommitTimestamp() {
return inCommitTimestamp;
}

public void setInCommitTimestamp(Optional<Long> inCommitTimestamp) {
this.inCommitTimestamp = inCommitTimestamp;
this.txnId = requireNonNull(txnId);
this.operationMetrics = Collections.unmodifiableMap(requireNonNull(operationMetrics));
}

public long getTimestamp() {
Expand All @@ -155,6 +148,30 @@ public String getOperation() {
return operation;
}

public Map<String, String> getOperationParameters() {
return operationParameters;
}

public boolean getIsBlindAppend() {
return isBlindAppend;
}

public String getTxnId() {
return txnId;
}

public Optional<Long> getInCommitTimestamp() {
return inCommitTimestamp;
}

public Map<String, String> getOperationMetrics() {
return operationMetrics;
}

public void setInCommitTimestamp(Optional<Long> inCommitTimestamp) {
this.inCommitTimestamp = inCommitTimestamp;
}

/**
* Encode as a {@link Row} object with the schema {@link CommitInfo#FULL_SCHEMA}.
*
Expand Down

0 comments on commit 4a61561

Please sign in to comment.