use of io.confluent.ksql.function.InternalFunctionRegistry in project ksql by confluentinc.
the class TopicCreateInjectorTest method setUp.
@Before
public void setUp() {
parser = new DefaultKsqlParser();
metaStore = new MetaStoreImpl(new InternalFunctionRegistry());
overrides = new HashMap<>();
config = new KsqlConfig(new HashMap<>());
injector = new TopicCreateInjector(topicClient, metaStore);
final KsqlTopic sourceTopic = new KsqlTopic("source", KeyFormat.nonWindowed(FormatInfo.of(FormatFactory.KAFKA.name()), SerdeFeatures.of()), ValueFormat.of(FormatInfo.of(FormatFactory.JSON.name()), SerdeFeatures.of()));
final KsqlStream<?> source = new KsqlStream<>("", SourceName.of("SOURCE"), SCHEMA, Optional.empty(), false, sourceTopic, false);
metaStore.putSource(source, false);
final KsqlTopic joinTopic = new KsqlTopic("jSource", KeyFormat.nonWindowed(FormatInfo.of(FormatFactory.KAFKA.name()), SerdeFeatures.of()), ValueFormat.of(FormatInfo.of(FormatFactory.JSON.name()), SerdeFeatures.of()));
final KsqlStream<?> joinSource = new KsqlStream<>("", SourceName.of("J_SOURCE"), SCHEMA, Optional.empty(), false, joinTopic, false);
metaStore.putSource(joinSource, false);
when(topicClient.describeTopic("source")).thenReturn(sourceDescription);
when(topicClient.isTopicExists("source")).thenReturn(true);
when(builder.withName(any())).thenReturn(builder);
when(builder.withWithClause(any(), any(), any())).thenReturn(builder);
when(builder.withSource(any())).thenReturn(builder);
when(builder.build()).thenReturn(new TopicProperties("name", 1, (short) 1));
}
use of io.confluent.ksql.function.InternalFunctionRegistry in project ksql by confluentinc.
the class TemporaryEngine method before.
@Override
protected void before() {
final InternalFunctionRegistry functionRegistry = new InternalFunctionRegistry();
metaStore = new MetaStoreImpl(functionRegistry);
serviceContext = TestServiceContext.create();
engine = (KsqlEngineTestUtil.createKsqlEngine(getServiceContext(), metaStore, new MetricCollectors()));
ksqlConfig = KsqlConfigTestUtil.create("localhost:9092", ImmutableMap.<String, Object>builder().putAll(configs).put("ksql.command.topic.suffix", "commands").put(KsqlRestConfig.LISTENERS_CONFIG, "http://localhost:8088").build());
final SqlTypeParser typeParser = SqlTypeParser.create(TypeRegistry.EMPTY);
final Optional<Metrics> noMetrics = Optional.empty();
final UdfLoader udfLoader = new UdfLoader(functionRegistry, noMetrics, typeParser, true);
udfLoader.loadUdfFromClass(TestUdf1.class, "test");
final UdtfLoader udtfLoader = new UdtfLoader(functionRegistry, noMetrics, typeParser, true);
udtfLoader.loadUdtfFromClass(TestUdtf1.class, "whatever");
udtfLoader.loadUdtfFromClass(TestUdtf2.class, "whatever");
}
use of io.confluent.ksql.function.InternalFunctionRegistry in project ksql by confluentinc.
the class RecoveryTest method createKsqlEngine.
private KsqlEngine createKsqlEngine(final QueryIdGenerator queryIdGenerator) {
final KsqlEngineMetrics engineMetrics = mock(KsqlEngineMetrics.class);
when(engineMetrics.getQueryEventListener()).thenReturn(mock(QueryEventListener.class));
return KsqlEngineTestUtil.createKsqlEngine(serviceContext, new MetaStoreImpl(new InternalFunctionRegistry()), ignored -> engineMetrics, queryIdGenerator, ksqlConfig, new MetricCollectors());
}
use of io.confluent.ksql.function.InternalFunctionRegistry in project ksql by confluentinc.
the class InteractiveStatementExecutorTest method setUp.
@Before
public void setUp() {
ksqlConfig = KsqlConfigTestUtil.create(CLUSTER, ImmutableMap.of(StreamsConfig.APPLICATION_SERVER_CONFIG, "http://host:1234"));
final FakeKafkaTopicClient fakeKafkaTopicClient = new FakeKafkaTopicClient();
fakeKafkaTopicClient.createTopic("pageview_topic", 1, (short) 1, emptyMap());
fakeKafkaTopicClient.createTopic("foo", 1, (short) 1, emptyMap());
fakeKafkaTopicClient.createTopic("pageview_topic_json", 1, (short) 1, emptyMap());
serviceContext = TestServiceContext.create(fakeKafkaTopicClient);
final SpecificQueryIdGenerator hybridQueryIdGenerator = new SpecificQueryIdGenerator();
final MetricCollectors metricCollectors = new MetricCollectors();
ksqlEngine = KsqlEngineTestUtil.createKsqlEngine(serviceContext, new MetaStoreImpl(new InternalFunctionRegistry()), (engine) -> new KsqlEngineMetrics("", engine, Collections.emptyMap(), Optional.empty(), metricCollectors), hybridQueryIdGenerator, ksqlConfig, metricCollectors);
statementParser = new StatementParser(ksqlEngine);
statementExecutor = new InteractiveStatementExecutor(serviceContext, ksqlEngine, statementParser, hybridQueryIdGenerator, InternalTopicSerdes.deserializer(Command.class));
statementExecutorWithMocks = new InteractiveStatementExecutor(serviceContext, mockEngine, mockParser, mockQueryIdGenerator, commandDeserializer);
statementExecutor.configure(ksqlConfig);
statementExecutorWithMocks.configure(ksqlConfig);
plannedCommand = new Command(CREATE_STREAM_FOO_STATEMENT, emptyMap(), ksqlConfig.getAllConfigPropsWithSecretsObfuscated(), Optional.of(plan));
}
use of io.confluent.ksql.function.InternalFunctionRegistry in project ksql by confluentinc.
the class AggregateNodeTest method buildAggregateNode.
private static AggregateNode buildAggregateNode(final String queryString) {
final MetaStore newMetaStore = MetaStoreFixture.getNewMetaStore(new InternalFunctionRegistry());
final KsqlBareOutputNode planNode = (KsqlBareOutputNode) AnalysisTestUtil.buildLogicalPlan(KSQL_CONFIG, queryString, newMetaStore);
return (AggregateNode) planNode.getSource();
}
Aggregations