Skip to content
Open
Show file tree
Hide file tree
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 @@ -112,6 +112,11 @@ public static IncrementalIndex getIncrementalIndex()
}
}

IncrementalIndex createIncrementalIndex()
{
return makeIncrementalIndex(TEST_FILE, METRIC_AGGS);
}

public static QueryableIndex getIncrementalIndex(int index1, int index2)
{
synchronized (log) {
Expand Down Expand Up @@ -178,45 +183,61 @@ public QueryableIndex getMergedIncrementalIndex()
return mergedIndex;
}

try {
IncrementalIndex top = makeIncrementalIndex("druid.sample.json.top", METRIC_AGGS);
IncrementalIndex bottom = makeIncrementalIndex("druid.sample.json.bottom", METRIC_AGGS);
mergedIndex = createMergedIncrementalIndex();
return mergedIndex;
}
}

File tmpFile = File.createTempFile("yay", "who");
tmpFile.delete();
QueryableIndex createMergedIncrementalIndex()
{
final IncrementalIndex top = makeIncrementalIndex("druid.sample.json.top", METRIC_AGGS);
final IncrementalIndex bottom = makeIncrementalIndex("druid.sample.json.bottom", METRIC_AGGS);
QueryableIndex topIndex = null;
QueryableIndex bottomIndex = null;

File topFile = new File(tmpFile, "top");
File bottomFile = new File(tmpFile, "bottom");
File mergedFile = new File(tmpFile, "merged");
try {
File tmpFile = FileUtils.createTempDir("yay");

FileUtils.mkdirp(topFile);
FileUtils.mkdirp(bottomFile);
FileUtils.mkdirp(mergedFile);
topFile.deleteOnExit();
bottomFile.deleteOnExit();
mergedFile.deleteOnExit();
File topFile = new File(tmpFile, "top");
File bottomFile = new File(tmpFile, "bottom");
File mergedFile = new File(tmpFile, "merged");

indexMerger.persist(top, topFile, INDEX_SPEC, null);
indexMerger.persist(bottom, bottomFile, INDEX_SPEC, null);
FileUtils.mkdirp(topFile);
FileUtils.mkdirp(bottomFile);
FileUtils.mkdirp(mergedFile);
topFile.deleteOnExit();
bottomFile.deleteOnExit();
mergedFile.deleteOnExit();

mergedIndex = indexIO.loadIndex(
indexMerger.mergeQueryableIndex(
Arrays.asList(indexIO.loadIndex(topFile), indexIO.loadIndex(bottomFile)),
true,
METRIC_AGGS,
mergedFile,
INDEX_SPEC,
null,
-1
)
);
indexMerger.persist(top, topFile, INDEX_SPEC, null);
indexMerger.persist(bottom, bottomFile, INDEX_SPEC, null);
topIndex = indexIO.loadIndex(topFile);
bottomIndex = indexIO.loadIndex(bottomFile);

return mergedIndex;
return indexIO.loadIndex(
indexMerger.mergeQueryableIndex(
Arrays.asList(topIndex, bottomIndex),
true,
METRIC_AGGS,
mergedFile,
INDEX_SPEC,
null,
-1
)
);
}
catch (IOException e) {
throw new RuntimeException(e);
}
finally {
if (topIndex != null) {
topIndex.close();
}
catch (IOException e) {
mergedIndex = null;
throw new RuntimeException(e);
if (bottomIndex != null) {
bottomIndex.close();
}
top.close();
bottom.close();
}
}

Expand All @@ -239,8 +260,7 @@ public QueryableIndex getMergedIncrementalIndex(int index1, int index2)
}

try {
File tmpFile = File.createTempFile("yay", "who");
tmpFile.delete();
File tmpFile = FileUtils.createTempDir("yay");

File mergedFile = new File(tmpFile, "merged");

Expand Down Expand Up @@ -277,8 +297,7 @@ public QueryableIndex getMergedIncrementalIndex(int[] indexes)
}

try {
File tmpFile = File.createTempFile("yay", "who");
tmpFile.delete();
File tmpFile = FileUtils.createTempDir("yay");

File mergedFile = new File(tmpFile, "merged");

Expand Down Expand Up @@ -364,9 +383,7 @@ private void makeRowPersistedIndexes()
new MapBasedInputRow(timestamp, dims, event)
);

File tmpFile = File.createTempFile("billy", "yay");
tmpFile.delete();
FileUtils.mkdirp(tmpFile);
File tmpFile = FileUtils.createTempDir("billy");
tmpFile.deleteOnExit();

indexMerger.persist(rowIndex, tmpFile, INDEX_SPEC, null);
Expand Down Expand Up @@ -444,8 +461,7 @@ private List<File> makeFilesToMap(File tmpFile, Iterable<Pair<String, Aggregator
private QueryableIndex makeMergedMMappedIndex(Iterable<Pair<String, AggregatorFactory[]>> files)
{
try {
File tmpFile = File.createTempFile("yay", "who");
tmpFile.delete();
File tmpFile = FileUtils.createTempDir("yay");
File mergedFile = new File(tmpFile, "merged");
FileUtils.mkdirp(mergedFile);
mergedFile.deleteOnExit();
Expand Down
Loading
Loading