Search in sources :

Example 1 with CustomType

use of io.confluent.ksql.metastore.TypeRegistry.CustomType in project ksql by confluentinc.

the class ListTypesExecutorTest method setUp.

@Before
public void setUp() {
    when(context.getMetaStore()).thenReturn(metaStore);
    when(metaStore.types()).thenReturn(ImmutableList.of(new CustomType("foo", SqlPrimitiveType.of(SqlBaseType.STRING))).iterator());
}
Also used : CustomType(io.confluent.ksql.metastore.TypeRegistry.CustomType) Before(org.junit.Before)

Example 2 with CustomType

use of io.confluent.ksql.metastore.TypeRegistry.CustomType in project ksql by confluentinc.

the class ListTypesExecutor method execute.

public static StatementExecutorResponse execute(final ConfiguredStatement<ListTypes> configuredStatement, final SessionProperties sessionProperties, final KsqlExecutionContext executionContext, final ServiceContext serviceContext) {
    final ImmutableMap.Builder<String, SchemaInfo> types = ImmutableMap.builder();
    final Iterator<CustomType> customTypes = executionContext.getMetaStore().types();
    while (customTypes.hasNext()) {
        final CustomType customType = customTypes.next();
        types.put(customType.getName(), EntityUtil.schemaInfo(customType.getType()));
    }
    return StatementExecutorResponse.handled(Optional.of(new TypeList(configuredStatement.getStatementText(), types.build())));
}
Also used : CustomType(io.confluent.ksql.metastore.TypeRegistry.CustomType) ImmutableMap(com.google.common.collect.ImmutableMap) TypeList(io.confluent.ksql.rest.entity.TypeList) SchemaInfo(io.confluent.ksql.rest.entity.SchemaInfo)

Aggregations

CustomType (io.confluent.ksql.metastore.TypeRegistry.CustomType)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 SchemaInfo (io.confluent.ksql.rest.entity.SchemaInfo)1 TypeList (io.confluent.ksql.rest.entity.TypeList)1 Before (org.junit.Before)1