diff --git a/core/src/main/java/org/apache/calcite/avatica/remote/looker/LookerRemoteMeta.java b/core/src/main/java/org/apache/calcite/avatica/remote/looker/LookerRemoteMeta.java index 416bc3f8d1..a821e89d35 100644 --- a/core/src/main/java/org/apache/calcite/avatica/remote/looker/LookerRemoteMeta.java +++ b/core/src/main/java/org/apache/calcite/avatica/remote/looker/LookerRemoteMeta.java @@ -156,12 +156,15 @@ private void streamResponse(String url, OutputStream outputStream) throws IOExce if (!sdkTransport.getOptions().getVerifySSL()) { trustAllHosts(connection); } + // timeout is given as seconds + int timeout = sdkTransport.getOptions().getTimeout() * 1000; + connection.setReadTimeout(timeout); connection.setRequestMethod("POST"); + connection.setRequestProperty("Accept", "application/json"); connection.setDoOutput(true); // Set the auth header as the SDK would connection.setRequestProperty("Authorization", "token " + authSession.getAuthToken().getAccessToken()); - connection.setRequestProperty("Accept", "application/json"); int responseCode = connection.getResponseCode(); if (responseCode == 200) { // grab the input stream and write to the output for the main thread to consume.