use of io.confluent.ksql.util.TransientQueryMetadata in project ksql by confluentinc.
the class EndToEndIntegrationTest method shouldSupportDroppingAndRecreatingJoinQuery.
@Test
public void shouldSupportDroppingAndRecreatingJoinQuery() throws Exception {
final String createStreamStatement = format("create stream cart_event_product as " + "select pv.userid, pv.pageid, u.gender " + "from %s pv left join %s u on pv.userid=u.userid;", PAGE_VIEW_STREAM, USER_TABLE);
executeStatement(createStreamStatement);
ksqlContext.terminateQuery(new QueryId("CSAS_CART_EVENT_PRODUCT_0"));
executeStatement("DROP STREAM CART_EVENT_PRODUCT;");
executeStatement(createStreamStatement);
final TransientQueryMetadata queryMetadata = executeStatement("SELECT * from cart_event_product EMIT CHANGES;");
final List<Object> columns = waitForFirstRow(queryMetadata);
if (sharedRuntimes) {
assertThat(TEST_HARNESS.getKafkaCluster().getTopics(), hasItem("_confluent-ksql-default_query-CSAS_CART_EVENT_PRODUCT_1-Join-repartition"));
} else {
assertThat(TEST_HARNESS.getKafkaCluster().getTopics(), hasItem("_confluent-ksql-default_query_CSAS_CART_EVENT_PRODUCT_1-Join-repartition"));
}
assertThat(CONSUMED_COUNT.get(), greaterThan(0));
assertThat(PRODUCED_COUNT.get(), greaterThan(0));
assertThat(columns.get(0).toString(), startsWith("USER_"));
assertThat(columns.get(1).toString(), startsWith("PAGE_"));
assertThat(columns.get(2).toString(), either(is("FEMALE")).or(is("MALE")));
}
use of io.confluent.ksql.util.TransientQueryMetadata in project ksql by confluentinc.
the class QueryExecutor method handlePushQuery.
private QueryMetadataHolder handlePushQuery(final ServiceContext serviceContext, final PreparedStatement<Query> statement, final Map<String, Object> streamsProperties, final boolean excludeTombstones) {
final ConfiguredStatement<Query> configured = ConfiguredStatement.of(statement, SessionConfig.of(ksqlConfig, streamsProperties));
if (QueryCapacityUtil.exceedsPushQueryCapacity(ksqlEngine, ksqlRestConfig)) {
QueryCapacityUtil.throwTooManyActivePushQueriesException(ksqlEngine, ksqlRestConfig, statement.getStatementText());
}
final TransientQueryMetadata query = ksqlEngine.executeTransientQuery(serviceContext, configured, excludeTombstones);
localCommands.ifPresent(lc -> lc.write(query));
log.info("Streaming query '{}'", statement.getStatementText());
return QueryMetadataHolder.of(query);
}
Aggregations