make BKD's temp file names a bit more descriptive

This commit is contained in:
Mike McCandless 2016-03-13 06:28:49 -04:00
parent 85739d8629
commit 641c6d30e8
2 changed files with 7 additions and 7 deletions

View File

@ -216,7 +216,7 @@ public class BKDWriter implements Closeable {
private void switchToOffline() throws IOException {
// For each .add we just append to this input file, then in .finish we sort this input and resursively build the tree:
offlinePointWriter = new OfflinePointWriter(tempDir, tempFileNamePrefix, packedBytesLength, longOrds);
offlinePointWriter = new OfflinePointWriter(tempDir, tempFileNamePrefix, packedBytesLength, longOrds, "switch");
tempInput = offlinePointWriter.out;
PointReader reader = heapPointWriter.getReader(0);
for(int i=0;i<pointCount;i++) {
@ -1172,8 +1172,8 @@ public class BKDWriter implements Closeable {
continue;
}
try (PointWriter leftPointWriter = getPointWriter(leftCount);
PointWriter rightPointWriter = getPointWriter(source.count - leftCount);
try (PointWriter leftPointWriter = getPointWriter(leftCount, "left" + dim);
PointWriter rightPointWriter = getPointWriter(source.count - leftCount, "right" + dim);
PointReader reader = slices[dim].writer.getReader(slices[dim].start);) {
// Partition this source according to how the splitDim split the values:
@ -1238,12 +1238,12 @@ public class BKDWriter implements Closeable {
return true;
}
PointWriter getPointWriter(long count) throws IOException {
PointWriter getPointWriter(long count, String desc) throws IOException {
if (count <= maxPointsSortInHeap) {
int size = Math.toIntExact(count);
return new HeapPointWriter(size, size, packedBytesLength, longOrds);
} else {
return new OfflinePointWriter(tempDir, tempFileNamePrefix, packedBytesLength, longOrds);
return new OfflinePointWriter(tempDir, tempFileNamePrefix, packedBytesLength, longOrds, desc);
}
}
}

View File

@ -33,8 +33,8 @@ final class OfflinePointWriter implements PointWriter {
// true if ords are written as long (8 bytes), else 4 bytes
private boolean longOrds;
public OfflinePointWriter(Directory tempDir, String tempFileNamePrefix, int packedBytesLength, boolean longOrds) throws IOException {
this.out = tempDir.createTempOutput(tempFileNamePrefix, "bkd", IOContext.DEFAULT);
public OfflinePointWriter(Directory tempDir, String tempFileNamePrefix, int packedBytesLength, boolean longOrds, String desc) throws IOException {
this.out = tempDir.createTempOutput(tempFileNamePrefix, "bkd_" + desc, IOContext.DEFAULT);
this.tempDir = tempDir;
this.packedBytesLength = packedBytesLength;
this.longOrds = longOrds;