Search in sources :

Example 6 with FunctionRegistry

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

the class SchemaKStreamTest method init.

@Before
public void init() {
    functionRegistry = new FunctionRegistry();
    ksqlStream = (KsqlStream) metaStore.getSource("TEST1");
    StreamsBuilder builder = new StreamsBuilder();
    kStream = builder.stream(ksqlStream.getKsqlTopic().getKafkaTopicName(), Consumed.with(Serdes.String(), ksqlStream.getKsqlTopic().getKsqlTopicSerDe().getGenericRowSerde(null, new KsqlConfig(Collections.emptyMap()), false, new MockSchemaRegistryClient())));
}
Also used : StreamsBuilder(org.apache.kafka.streams.StreamsBuilder) FunctionRegistry(io.confluent.ksql.function.FunctionRegistry) MockSchemaRegistryClient(io.confluent.kafka.schemaregistry.client.MockSchemaRegistryClient) KsqlConfig(io.confluent.ksql.util.KsqlConfig) Before(org.junit.Before)

Example 7 with FunctionRegistry

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

the class SchemaKTableTest method init.

@Before
public void init() {
    functionRegistry = new FunctionRegistry();
    ksqlTable = (KsqlTable) metaStore.getSource("TEST2");
    StreamsBuilder builder = new StreamsBuilder();
    kTable = builder.table(ksqlTable.getKsqlTopic().getKafkaTopicName(), Consumed.with(Serdes.String(), ksqlTable.getKsqlTopic().getKsqlTopicSerDe().getGenericRowSerde(null, new KsqlConfig(Collections.emptyMap()), false, new MockSchemaRegistryClient())));
}
Also used : StreamsBuilder(org.apache.kafka.streams.StreamsBuilder) FunctionRegistry(io.confluent.ksql.function.FunctionRegistry) MockSchemaRegistryClient(io.confluent.kafka.schemaregistry.client.MockSchemaRegistryClient) KsqlConfig(io.confluent.ksql.util.KsqlConfig) Before(org.junit.Before)

Example 8 with FunctionRegistry

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

the class SelectValueMapperTest method createExpressionMetadata.

private List<ExpressionMetadata> createExpressionMetadata(final List<Pair<String, Expression>> expressionPairList, final Schema schema) throws Exception {
    final CodeGenRunner codeGenRunner = new CodeGenRunner(schema, new FunctionRegistry());
    final List<ExpressionMetadata> expressionEvaluators = new ArrayList<>();
    for (Pair<String, Expression> expressionPair : expressionPairList) {
        final ExpressionMetadata expressionEvaluator = codeGenRunner.buildCodeGenFromParseTree(expressionPair.getRight());
        expressionEvaluators.add(expressionEvaluator);
    }
    return expressionEvaluators;
}
Also used : ExpressionMetadata(io.confluent.ksql.util.ExpressionMetadata) FunctionRegistry(io.confluent.ksql.function.FunctionRegistry) CodeGenRunner(io.confluent.ksql.codegen.CodeGenRunner) Expression(io.confluent.ksql.parser.tree.Expression) ArrayList(java.util.ArrayList)

Example 9 with FunctionRegistry

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

the class ExpressionTypeManagerTest method init.

@Before
public void init() {
    metaStore = MetaStoreFixture.getNewMetaStore();
    functionRegistry = new FunctionRegistry();
    schema = SchemaBuilder.struct().field("TEST1.COL0", SchemaBuilder.INT64_SCHEMA).field("TEST1.COL1", SchemaBuilder.STRING_SCHEMA).field("TEST1.COL2", SchemaBuilder.STRING_SCHEMA).field("TEST1.COL3", SchemaBuilder.FLOAT64_SCHEMA);
}
Also used : FunctionRegistry(io.confluent.ksql.function.FunctionRegistry) Before(org.junit.Before)

Example 10 with FunctionRegistry

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

the class SqlPredicateTest method init.

@Before
public void init() {
    metaStore = MetaStoreFixture.getNewMetaStore();
    functionRegistry = new FunctionRegistry();
    ksqlStream = (KsqlStream) metaStore.getSource("TEST1");
    StreamsBuilder builder = new StreamsBuilder();
    kStream = builder.stream(ksqlStream.getKsqlTopic().getKafkaTopicName(), Consumed.with(Serdes.String(), ksqlStream.getKsqlTopic().getKsqlTopicSerDe().getGenericRowSerde(null, new KsqlConfig(Collections.emptyMap()), false, new MockSchemaRegistryClient())));
}
Also used : StreamsBuilder(org.apache.kafka.streams.StreamsBuilder) FunctionRegistry(io.confluent.ksql.function.FunctionRegistry) MockSchemaRegistryClient(io.confluent.kafka.schemaregistry.client.MockSchemaRegistryClient) KsqlConfig(io.confluent.ksql.util.KsqlConfig) Before(org.junit.Before)

Aggregations

FunctionRegistry (io.confluent.ksql.function.FunctionRegistry)16 MockSchemaRegistryClient (io.confluent.kafka.schemaregistry.client.MockSchemaRegistryClient)9 StreamsBuilder (org.apache.kafka.streams.StreamsBuilder)8 Before (org.junit.Before)8 KsqlConfig (io.confluent.ksql.util.KsqlConfig)7 KafkaTopicClient (io.confluent.ksql.util.KafkaTopicClient)4 Test (org.junit.Test)4 SchemaKStream (io.confluent.ksql.structured.SchemaKStream)3 Schema (org.apache.kafka.connect.data.Schema)3 SchemaRegistryClient (io.confluent.kafka.schemaregistry.client.SchemaRegistryClient)2 CodeGenRunner (io.confluent.ksql.codegen.CodeGenRunner)2 Expression (io.confluent.ksql.parser.tree.Expression)2 SchemaKTable (io.confluent.ksql.structured.SchemaKTable)2 ExpressionMetadata (io.confluent.ksql.util.ExpressionMetadata)2 FakeKafkaTopicClient (io.confluent.ksql.util.FakeKafkaTopicClient)2 KsqlException (io.confluent.ksql.util.KsqlException)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 GenericRow (io.confluent.ksql.GenericRow)1 KsqlStream (io.confluent.ksql.metastore.KsqlStream)1