Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.
Open
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 @@ -404,6 +404,11 @@ private WriterHolder writeQuerySummary(QueryInfo queryInfo) throws Exception {
try {
querySummaryWriter.out.writeInt(jsonBytes.length);
querySummaryWriter.out.write(jsonBytes);
//If object storage, close the output stream in order to create a readable object.
if(isObjectStorage(querySummaryWriter.path.toUri().getScheme())){
IOUtils.cleanup(LOG, querySummaryWriter);
querySummaryWriter.out = null;
}
} catch (IOException ie) {
IOUtils.cleanup(LOG, querySummaryWriter);
querySummaryWriter.out = null;
Expand Down Expand Up @@ -484,6 +489,19 @@ private FSDataOutputStream createTaskHistoryFile(String taskStartTime, WriterHol
writerHolder.path = path;
return fs.create(path, false, 4096, taskReplication, fs.getDefaultBlockSize(path));
}

/*
* Discern object storage.
* - gs:google cloud storage
* - s3: AWS object storage
*/
private boolean isObjectStorage(String scheme) {
if(scheme.indexOf("gs") != -1 || scheme.indexOf("s3") != -1 ){
return true;
} else {
return false;
}
}
}

public static Path getQueryTaskHistoryPath(FileSystem fs, Path parent,
Expand Down