Skip to content
Merged
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
8 changes: 8 additions & 0 deletions src/main/java/com/treasuredata/client/TDClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -748,10 +748,18 @@ public TDJob jobInfo(String jobId)
@Override
public <Result> Result jobResult(String jobId, TDResultFormat format, Function<InputStream, Result> resultStreamHandler)
throws TDClientException
{
return jobResult(jobId, format, false, resultStreamHandler);
}

@Override
public <Result> Result jobResult(String jobId, TDResultFormat format, boolean includeHeader, Function<InputStream, Result> resultStreamHandler)
throws TDClientException
{
TDApiRequest request = TDApiRequest.Builder
.GET(buildUrl("/v3/job/result", jobId))
.addQueryParam("format", format.getName())
.addQueryParam("header", Boolean.toString(includeHeader))
.build();
return httpClient.<Result>call(request, apiKeyCache, resultStreamHandler);
}
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/com/treasuredata/client/TDClientApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,20 @@ default <Result> Result jobResult(String jobId, TDResultFormat format, com.googl
*/
<Result> Result jobResult(String jobId, TDResultFormat format, Function<InputStream, Result> resultStreamHandler);

/**
* Open an input stream to retrieve the job result.
* The input stream will be closed after this method
*
* You will receive an empty stream if the query has not finished yet.
*
* @param jobId
* @param format
* @param resultStreamHandler
* @param includeHeader
* @return
*/
<Result> Result jobResult(String jobId, TDResultFormat format, boolean includeHeader, Function<InputStream, Result> resultStreamHandler);

// bulk import API
List<TDBulkImportSession> listBulkImportSessions();

Expand Down
Loading