Search in sources :

Example 21 with QueryContext

use of io.confluent.ksql.execution.context.QueryContext in project ksql by confluentinc.

the class StreamTableJoinBuilderTest method shouldBuildLeftSerdeCorrectly.

@Test
public void shouldBuildLeftSerdeCorrectly() {
    // Given:
    givenInnerJoin(SYNTH_KEY);
    // When:
    join.build(planBuilder, planInfo);
    // Then:
    final QueryContext leftCtx = QueryContext.Stacker.of(CTX).push("Left").getQueryContext();
    verify(buildContext).buildValueSerde(FormatInfo.of(FormatFactory.JSON.name()), LEFT_PHYSICAL, leftCtx);
}
Also used : QueryContext(io.confluent.ksql.execution.context.QueryContext) Test(org.junit.Test)

Example 22 with QueryContext

use of io.confluent.ksql.execution.context.QueryContext in project ksql by confluentinc.

the class StreamAggregateBuilderTest method shouldReturnCorrectSerdeForWindowedAggregate.

@Test
public void shouldReturnCorrectSerdeForWindowedAggregate() {
    for (final Runnable given : given()) {
        // Given:
        clearInvocations(groupedStream, timeWindowedStream, sessionWindowedStream, aggregated, buildContext);
        given.run();
        // When:
        final KTableHolder<Windowed<GenericKey>> tableHolder = windowedAggregate.build(planBuilder, planInfo);
        // Then:
        final ExecutionKeyFactory<Windowed<GenericKey>> serdeFactory = tableHolder.getExecutionKeyFactory();
        final FormatInfo mockFormat = mock(FormatInfo.class);
        final PhysicalSchema mockSchema = mock(PhysicalSchema.class);
        final QueryContext mockCtx = mock(QueryContext.class);
        serdeFactory.buildKeySerde(mockFormat, mockSchema, mockCtx);
        verify(buildContext).buildKeySerde(same(mockFormat), eq(windowedAggregate.getWindowExpression().getWindowInfo()), same(mockSchema), same(mockCtx));
    }
}
Also used : Windowed(org.apache.kafka.streams.kstream.Windowed) PhysicalSchema(io.confluent.ksql.schema.ksql.PhysicalSchema) QueryContext(io.confluent.ksql.execution.context.QueryContext) FormatInfo(io.confluent.ksql.serde.FormatInfo) Test(org.junit.Test)

Aggregations

QueryContext (io.confluent.ksql.execution.context.QueryContext)22 GenericRow (io.confluent.ksql.GenericRow)13 LogicalSchema (io.confluent.ksql.schema.ksql.LogicalSchema)12 PhysicalSchema (io.confluent.ksql.schema.ksql.PhysicalSchema)10 ProcessingLogger (io.confluent.ksql.logging.processing.ProcessingLogger)8 Formats (io.confluent.ksql.execution.plan.Formats)7 Test (org.junit.Test)7 RuntimeBuildContext (io.confluent.ksql.execution.runtime.RuntimeBuildContext)5 Serde (org.apache.kafka.common.serialization.Serde)5 GenericKey (io.confluent.ksql.GenericKey)4 VisibleForTesting (com.google.common.annotations.VisibleForTesting)3 CodeGenRunner (io.confluent.ksql.execution.codegen.CodeGenRunner)3 CompiledExpression (io.confluent.ksql.execution.codegen.CompiledExpression)3 Expression (io.confluent.ksql.execution.expression.tree.Expression)3 KTableHolder (io.confluent.ksql.execution.plan.KTableHolder)3 KsTransformer (io.confluent.ksql.execution.streams.transform.KsTransformer)3 Objects.requireNonNull (java.util.Objects.requireNonNull)3 Named (org.apache.kafka.streams.kstream.Named)3 KeyValueStore (org.apache.kafka.streams.state.KeyValueStore)3 MaterializationInfo (io.confluent.ksql.execution.materialization.MaterializationInfo)2