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);
}
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");
}
Aggregations