Skip to content

Commit 07be753

Browse files
committed
format
1 parent 22c4c8f commit 07be753

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

kernel/kernel-api/src/main/java/io/delta/kernel/internal/DeltaHistoryManager.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,16 +139,16 @@ public static Commit getActiveCommitAtTimestamp(
139139
throw DeltaErrors.timestampBeforeFirstAvailableCommit(
140140
logPath.getParent().toString(), /* use dataPath */
141141
timestamp,
142-
searchResult.timestamp,
143-
searchResult.version);
142+
searchResult.timestamp,
143+
searchResult.version);
144144
}
145145
// If timestamp is after the last commit of the table
146146
if (searchResult.timestamp < timestamp && !canReturnLastCommit) {
147147
throw DeltaErrors.timestampAfterLatestCommit(
148148
logPath.getParent().toString(), /* use dataPath */
149149
timestamp,
150-
searchResult.timestamp,
151-
searchResult.version);
150+
searchResult.timestamp,
151+
searchResult.version);
152152
}
153153

154154
return searchResult;
@@ -160,8 +160,9 @@ private static long getInitialCommitVersionForICTSearch(
160160
// Fit a line through the start and end commits build a very rough linear model
161161
// targetCommit = startCommit.version + (searchTimestamp - startCommit.getTimestamp()) /
162162
// commitsPerMillisecond
163-
long commitsPerMillisecond = (endCommit.getVersion() - startCommit.getVersion()) /
164-
Math.max((endCommit.getTimestamp() - startCommit.getTimestamp()), 1);
163+
long commitsPerMillisecond =
164+
(endCommit.getVersion() - startCommit.getVersion())
165+
/ Math.max((endCommit.getTimestamp() - startCommit.getTimestamp()), 1);
165166
long approximateCommitVersion =
166167
startCommit.version
167168
+ (searchTimestamp - startCommit.getTimestamp()) * commitsPerMillisecond;

kernel/kernel-api/src/main/java/io/delta/kernel/internal/util/InternalUtils.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
import io.delta.kernel.data.ColumnVector;
1919
import io.delta.kernel.data.ColumnarBatch;
2020
import io.delta.kernel.data.Row;
21-
import io.delta.kernel.internal.DeltaHistoryManager;
22-
import io.delta.kernel.internal.actions.CommitInfo;
2321
import io.delta.kernel.internal.fs.Path;
2422
import io.delta.kernel.types.DataType;
2523
import io.delta.kernel.types.StringType;
@@ -172,7 +170,10 @@ public static Set<String> toLowerCaseSet(Collection<String> set) {
172170
}
173171

174172
public static Tuple2<Long, Long> greatestLowerBound(
175-
long target, long lowerBoundInclusive, long upperBoundExclusive, Function<Long, Long> keyToValueMapper) {
173+
long target,
174+
long lowerBoundInclusive,
175+
long upperBoundExclusive,
176+
Function<Long, Long> keyToValueMapper) {
176177
long start = lowerBoundInclusive;
177178
long end = upperBoundExclusive;
178179
Tuple2<Long, Long> result = null;
@@ -192,12 +193,18 @@ public static Tuple2<Long, Long> greatestLowerBound(
192193
}
193194

194195
public static Tuple2<Long, Long> getNarrowSearchBoundsUsingExponentialSearch(
195-
long target, long lowerBoundInclusive, long upperBoundExclusive, Function<Long, Long> keyToValueMapper, boolean reversed) {
196+
long target,
197+
long lowerBoundInclusive,
198+
long upperBoundExclusive,
199+
Function<Long, Long> keyToValueMapper,
200+
boolean reversed) {
196201
final long iterationDirection = reversed ? -1 : 1;
197202
long lowerBoundKey = lowerBoundInclusive;
198203
long upperBoundKey;
199204
long curKey = lowerBoundInclusive + 1;
200-
for (long i = 0; curKey < upperBoundExclusive; curKey = Math.round(lowerBoundInclusive + iterationDirection*Math.pow(2, i++))) {
205+
for (long i = 0;
206+
curKey < upperBoundExclusive;
207+
curKey = Math.round(lowerBoundInclusive + iterationDirection * Math.pow(2, i++))) {
201208
long curValue = keyToValueMapper.apply(curKey);
202209
if (curValue > target) {
203210
break;
@@ -206,6 +213,8 @@ public static Tuple2<Long, Long> getNarrowSearchBoundsUsingExponentialSearch(
206213
}
207214
}
208215
upperBoundKey = Math.min(curKey, upperBoundExclusive);
209-
return reversed ? new Tuple2<>(upperBoundKey, lowerBoundKey) : new Tuple2<>(lowerBoundKey, upperBoundKey);
216+
return reversed
217+
? new Tuple2<>(upperBoundKey, lowerBoundKey)
218+
: new Tuple2<>(lowerBoundKey, upperBoundKey);
210219
}
211220
}

0 commit comments

Comments
 (0)