public StatementClientV1(OkHttpClient httpClient, ClientSession session, String query) { requireNonNull(httpClient, "httpClient is null"); requireNonNull(session, "session is null"); requireNonNull(query, "query is null"); this.httpClient = httpClient; this.timeZone = session.getTimeZone(); this.query = query; this.requestTimeoutNanos = session.getClientRequestTimeout(); this.user = session.getUser(); this.clientCapabilities = Joiner.on(",").join(ClientCapabilities.values()); Request request = buildQueryRequest(session, query); JsonResponse<QueryResults> response = JsonResponse.execute(QUERY_RESULTS_CODEC, httpClient, request); if ((response.getStatusCode() != HTTP_OK) || !response.hasValue()) { state.compareAndSet(State.RUNNING, State.CLIENT_ERROR); throw requestFailedException("starting query", request, response); } processResponse(response.getHeaders(), response.getValue()); }
builder.addHeader(PRESTO_PATH, session.getPath()); builder.addHeader(PRESTO_TIME_ZONE, session.getTimeZone().getId()); if (session.getLocale() != null) { builder.addHeader(PRESTO_LANGUAGE, session.getLocale().toLanguageTag());
private Builder(ClientSession clientSession) { requireNonNull(clientSession, "clientSession is null"); server = clientSession.getServer(); user = clientSession.getUser(); source = clientSession.getSource(); traceToken = clientSession.getTraceToken(); clientTags = clientSession.getClientTags(); clientInfo = clientSession.getClientInfo(); catalog = clientSession.getCatalog(); schema = clientSession.getSchema(); path = clientSession.getPath(); timeZone = clientSession.getTimeZone(); locale = clientSession.getLocale(); resourceEstimates = clientSession.getResourceEstimates(); properties = clientSession.getProperties(); preparedStatements = clientSession.getPreparedStatements(); transactionId = clientSession.getTransactionId(); clientRequestTimeout = clientSession.getClientRequestTimeout(); }
public QueryTracker(ClientSession session) { this.session = session; this.zone = Optional.ofNullable(session.getTimeZone()).map(e -> ZoneId.of(e.getId())).orElse(ZoneOffset.UTC); }