use of io.confluent.ksql.api.client.BatchedQueryResult in project ksql by confluentinc.
the class ClientImpl method executeQuery.
@Override
public BatchedQueryResult executeQuery(final String sql, final Map<String, Object> properties) {
if (clientOptions.getConsistencyLevel() == ConsistencyLevel.MONOTONIC_SESSION) {
requestProperties.put(KsqlRequestConfig.KSQL_REQUEST_QUERY_PULL_CONSISTENCY_OFFSET_VECTOR, serializedConsistencyVector.get());
}
final BatchedQueryResult result = new BatchedQueryResultImpl();
makeQueryRequest(sql, properties, result, (context, recordParser, cf, request) -> new ExecuteQueryResponseHandler(context, recordParser, cf, clientOptions.getExecuteQueryMaxResultRows(), serializedConsistencyVector));
return result;
}
use of io.confluent.ksql.api.client.BatchedQueryResult in project ksql by confluentinc.
the class ClientIntegrationTest method shouldExecutePushWithLimitQuery.
@Test
public void shouldExecutePushWithLimitQuery() throws Exception {
// When
final BatchedQueryResult batchedQueryResult = client.executeQuery(PUSH_QUERY_WITH_LIMIT);
// Then
assertThat(batchedQueryResult.queryID().get(), is(notNullValue()));
verifyStreamRows(batchedQueryResult.get(), PUSH_QUERY_LIMIT_NUM_ROWS);
}
use of io.confluent.ksql.api.client.BatchedQueryResult in project ksql by confluentinc.
the class ClientIntegrationTest method shouldExecutePullQuery.
@Test
public void shouldExecutePullQuery() throws Exception {
// When
final BatchedQueryResult batchedQueryResult = client.executeQuery(PULL_QUERY_ON_TABLE);
// Then
assertThat(batchedQueryResult.queryID().get(), is(notNullValue()));
verifyPullQueryRows(batchedQueryResult.get());
}
use of io.confluent.ksql.api.client.BatchedQueryResult in project ksql by confluentinc.
the class ClientIntegrationTest method shouldTerminatePushQueryIssuedViaExecuteQuery.
@Test
public void shouldTerminatePushQueryIssuedViaExecuteQuery() throws Exception {
// Given: one persistent query for the agg table
verifyNumActiveQueries(1);
// Issue non-terminating push query via executeQuery(). This is NOT an expected use case
final BatchedQueryResult batchedQueryResult = client.executeQuery(PUSH_QUERY);
final String queryId = batchedQueryResult.queryID().get();
assertThat(queryId, is(notNullValue()));
// Query is running on server, and StreamedQueryResult is not complete
verifyNumActiveQueries(2);
assertThat(batchedQueryResult.isDone(), is(false));
// When
client.terminatePushQuery(queryId).get();
// Then: query is no longer running on server, and BatchedQueryResult is complete
verifyNumActiveQueries(1);
assertThatEventually(batchedQueryResult::isDone, is(true));
assertThat(batchedQueryResult.isCompletedExceptionally(), is(false));
}
use of io.confluent.ksql.api.client.BatchedQueryResult in project ksql by confluentinc.
the class ConsistencyOffsetVectorFunctionalTest method shouldNotRoundTripCVWhenExecutePullQuery.
@Test
public void shouldNotRoundTripCVWhenExecutePullQuery() throws Exception {
// When
final BatchedQueryResult batchedQueryResult = eventualClient.executeQuery(PULL_QUERY_ON_TABLE);
batchedQueryResult.get();
// Then
assertThat(batchedQueryResult.queryID().get(), is(notNullValue()));
assertThat(((ClientImpl) eventualClient).getSerializedConsistencyVector(), is(isEmptyString()));
}
Aggregations