Search in sources :

Example 6 with SqlTypeParser

use of io.confluent.ksql.schema.ksql.SqlTypeParser in project ksql by confluentinc.

the class UdtfLoaderTest method shouldNotLoadUdtfWithRawListReturn.

@Test
public void shouldNotLoadUdtfWithRawListReturn() {
    // Given:
    final MutableFunctionRegistry functionRegistry = new InternalFunctionRegistry();
    final SqlTypeParser typeParser = create(EMPTY);
    final UdtfLoader udtfLoader = new UdtfLoader(functionRegistry, empty(), typeParser, true);
    // When:
    final Exception e = assertThrows(KsqlException.class, () -> udtfLoader.loadUdtfFromClass(RawListReturn.class, INTERNAL_PATH));
    // Then:
    assertThat(e.getMessage(), containsString("UDTF functions must return a parameterized List. Class io.confluent.ksql.function.UdtfLoaderTest$RawListReturn Method badReturn"));
}
Also used : SqlTypeParser(io.confluent.ksql.schema.ksql.SqlTypeParser) KsqlException(io.confluent.ksql.util.KsqlException) Test(org.junit.Test)

Aggregations

SqlTypeParser (io.confluent.ksql.schema.ksql.SqlTypeParser)6 KsqlException (io.confluent.ksql.util.KsqlException)5 Test (org.junit.Test)3 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 UdfUtil (io.confluent.ksql.execution.function.UdfUtil)1 InternalFunctionRegistry (io.confluent.ksql.function.InternalFunctionRegistry)1 UdfLoader (io.confluent.ksql.function.UdfLoader)1 UdtfLoader (io.confluent.ksql.function.UdtfLoader)1 GenericType (io.confluent.ksql.function.types.GenericType)1 LambdaType (io.confluent.ksql.function.types.LambdaType)1 ParamType (io.confluent.ksql.function.types.ParamType)1 ParamTypes (io.confluent.ksql.function.types.ParamTypes)1 Udf (io.confluent.ksql.function.udf.Udf)1 UdfParameter (io.confluent.ksql.function.udf.UdfParameter)1 UdfSchemaProvider (io.confluent.ksql.function.udf.UdfSchemaProvider)1 MetaStoreImpl (io.confluent.ksql.metastore.MetaStoreImpl)1 TypeRegistry (io.confluent.ksql.metastore.TypeRegistry)1 MetricCollectors (io.confluent.ksql.metrics.MetricCollectors)1