use of io.confluent.ksql.util.TransientQueryMetadata in project ksql by confluentinc.
the class QueryDescriptionFactoryTest method shouldHandleRowTimeInValueSchemaForTransientQuery.
@Test
public void shouldHandleRowTimeInValueSchemaForTransientQuery() {
// Given:
final LogicalSchema schema = LogicalSchema.builder().valueColumn(ColumnName.of("field1"), SqlTypes.INTEGER).valueColumn(ColumnName.of("ROWTIME"), SqlTypes.BIGINT).valueColumn(ColumnName.of("field2"), SqlTypes.STRING).build();
transientQuery = new TransientQueryMetadata(SQL_TEXT, schema, SOURCE_NAMES, "execution plan", queryQueue, QUERY_ID, "app id", topology, kafkaStreamsBuilder, STREAMS_PROPS, PROP_OVERRIDES, closeTimeout, 10, ResultType.STREAM, 0L, 0L, listener);
transientQuery.initialize();
// When:
transientQueryDescription = QueryDescriptionFactory.forQueryMetadata(transientQuery, Collections.emptyMap());
// Then:
assertThat(transientQueryDescription.getFields(), contains(new FieldInfo("field1", new SchemaInfo(SqlBaseType.INTEGER, null, null), Optional.empty()), new FieldInfo("ROWTIME", new SchemaInfo(SqlBaseType.BIGINT, null, null), Optional.empty()), new FieldInfo("field2", new SchemaInfo(SqlBaseType.STRING, null, null), Optional.empty())));
}
use of io.confluent.ksql.util.TransientQueryMetadata in project ksql by confluentinc.
the class ListQueriesExecutorTest method givenTransientQuery.
public static TransientQueryMetadata givenTransientQuery(final String id, final KafkaStreams.State state) {
final TransientQueryMetadata metadata = mock(TransientQueryMetadata.class);
mockQuery(id, state, metadata);
when(metadata.getQueryType()).thenReturn(KsqlConstants.KsqlQueryType.PUSH);
return metadata;
}
use of io.confluent.ksql.util.TransientQueryMetadata in project ksql by confluentinc.
the class QueryDescriptionFactoryTest method setUp.
@Before
public void setUp() {
when(topology.describe()).thenReturn(topologyDescription);
when(kafkaStreamsBuilder.build(any(), any())).thenReturn(queryStreams);
when(queryStreams.metadataForLocalThreads()).thenReturn(Collections.emptySet());
when(sinkTopic.getKeyFormat()).thenReturn(KeyFormat.nonWindowed(FormatInfo.of(FormatFactory.KAFKA.name()), SerdeFeatures.of()));
when(sinkDataSource.getKsqlTopic()).thenReturn(sinkTopic);
when(sinkDataSource.getName()).thenReturn(SourceName.of("sink name"));
transientQuery = new TransientQueryMetadata(SQL_TEXT, TRANSIENT_SCHEMA, SOURCE_NAMES, "execution plan", queryQueue, QUERY_ID, APPLICATION_ID, topology, kafkaStreamsBuilder, STREAMS_PROPS, PROP_OVERRIDES, closeTimeout, 10, ResultType.STREAM, 0L, 0L, listener);
transientQuery.initialize();
transientQueryDescription = QueryDescriptionFactory.forQueryMetadata(transientQuery, Collections.emptyMap());
persistentQuery = new PersistentQueryMetadataImpl(KsqlConstants.PersistentQueryType.CREATE_AS, SQL_TEXT, PhysicalSchema.from(PERSISTENT_SCHEMA, SerdeFeatures.of(), SerdeFeatures.of()), SOURCE_NAMES, Optional.of(sinkDataSource), "execution plan", QUERY_ID, Optional.empty(), APPLICATION_ID, topology, kafkaStreamsBuilder, new QuerySchemas(), STREAMS_PROPS, PROP_OVERRIDES, closeTimeout, QueryErrorClassifier.DEFAULT_CLASSIFIER, physicalPlan, 10, processingLogger, 0L, 0L, listener, Optional.empty());
persistentQuery.initialize();
persistentQueryDescription = QueryDescriptionFactory.forQueryMetadata(persistentQuery, STATUS_MAP);
}
use of io.confluent.ksql.util.TransientQueryMetadata in project ksql by confluentinc.
the class KsqlResourceTest method validateTransientQueryDescription.
private void validateTransientQueryDescription(final String ksqlQueryString, final Map<String, Object> overriddenProperties, final KsqlEntity entity) {
final TransientQueryMetadata queryMetadata = KsqlEngineTestUtil.executeQuery(serviceContext, ksqlEngine, ksqlQueryString, ksqlConfig, overriddenProperties);
validateQueryDescription(queryMetadata, overriddenProperties, entity);
}
use of io.confluent.ksql.util.TransientQueryMetadata in project ksql by confluentinc.
the class TerminateQueryExecutorTest method givenTransientQuery.
public static TransientQueryMetadata givenTransientQuery(final String id, final KafkaStreams.State state) {
final TransientQueryMetadata metadata = mock(TransientQueryMetadata.class);
mockQuery(id, state, metadata);
return metadata;
}
Aggregations