Search in sources :

Example 1 with UdtfLoader

use of io.confluent.ksql.function.UdtfLoader in project ksql by confluentinc.

the class FlatMapNodeTest method setUp.

@Before
public void setUp() {
    when(source.getSchema()).thenReturn(SOURCE_SCHEMA);
    when(source.getNodeOutputType()).thenReturn(DataSourceType.KSTREAM);
    when(analysis.getTableFunctions()).thenReturn(ImmutableList.of(A_TABLE_FUNCTION));
    when(analysis.getSelectItems()).thenReturn(ImmutableList.of(new AllColumns(Optional.empty()), new SingleColumn(new UnqualifiedColumnReferenceExp(COL0), Optional.empty()), new SingleColumn(A_TABLE_FUNCTION, Optional.empty())));
    final MutableFunctionRegistry functionRegistry = new InternalFunctionRegistry();
    new UdtfLoader(functionRegistry, Optional.empty(), SqlTypeParser.create(TypeRegistry.EMPTY), true).loadUdtfFromClass(Explode.class, "load path");
    flatMapNode = new FlatMapNode(PLAN_ID, source, functionRegistry, analysis);
}
Also used : MutableFunctionRegistry(io.confluent.ksql.function.MutableFunctionRegistry) AllColumns(io.confluent.ksql.parser.tree.AllColumns) SingleColumn(io.confluent.ksql.parser.tree.SingleColumn) UnqualifiedColumnReferenceExp(io.confluent.ksql.execution.expression.tree.UnqualifiedColumnReferenceExp) InternalFunctionRegistry(io.confluent.ksql.function.InternalFunctionRegistry) UdtfLoader(io.confluent.ksql.function.UdtfLoader) Before(org.junit.Before)

Example 2 with UdtfLoader

use of io.confluent.ksql.function.UdtfLoader 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");
}
Also used : Metrics(org.apache.kafka.common.metrics.Metrics) MetaStoreImpl(io.confluent.ksql.metastore.MetaStoreImpl) MetricCollectors(io.confluent.ksql.metrics.MetricCollectors) SqlTypeParser(io.confluent.ksql.schema.ksql.SqlTypeParser) InternalFunctionRegistry(io.confluent.ksql.function.InternalFunctionRegistry) UdfLoader(io.confluent.ksql.function.UdfLoader) UdtfLoader(io.confluent.ksql.function.UdtfLoader)

Aggregations

InternalFunctionRegistry (io.confluent.ksql.function.InternalFunctionRegistry)2 UdtfLoader (io.confluent.ksql.function.UdtfLoader)2 UnqualifiedColumnReferenceExp (io.confluent.ksql.execution.expression.tree.UnqualifiedColumnReferenceExp)1 MutableFunctionRegistry (io.confluent.ksql.function.MutableFunctionRegistry)1 UdfLoader (io.confluent.ksql.function.UdfLoader)1 MetaStoreImpl (io.confluent.ksql.metastore.MetaStoreImpl)1 MetricCollectors (io.confluent.ksql.metrics.MetricCollectors)1 AllColumns (io.confluent.ksql.parser.tree.AllColumns)1 SingleColumn (io.confluent.ksql.parser.tree.SingleColumn)1 SqlTypeParser (io.confluent.ksql.schema.ksql.SqlTypeParser)1 Metrics (org.apache.kafka.common.metrics.Metrics)1 Before (org.junit.Before)1