Search in sources :

Example 1 with DataSource

use of io.confluent.ksql.serde.DataSource in project ksql by confluentinc.

the class KsqlResource method describe.

private SourceDescription describe(String name, boolean extended) throws KsqlException {
    StructuredDataSource dataSource = ksqlEngine.getMetaStore().getSource(name);
    if (dataSource == null) {
        throw new KsqlException(String.format("Could not find STREAM/TABLE '%s' in the Metastore", name));
    }
    List<PersistentQueryMetadata> queries = ksqlEngine.getPersistentQueries().values().stream().filter(meta -> ((KsqlStructuredDataOutputNode) meta.getOutputNode()).getKafkaTopicName().equals(dataSource.getKsqlTopic().getTopicName())).collect(Collectors.toList());
    return new SourceDescription(dataSource, extended, dataSource.getKsqlTopic().getKsqlTopicSerDe().getSerDe().name(), "", "", getReadQueryIds(queries), getWriteQueryIds(queries), ksqlEngine.getTopicClient());
}
Also used : CreateTableCommand(io.confluent.ksql.ddl.commands.CreateTableCommand) Query(io.confluent.ksql.parser.tree.Query) CreateTableAsSelect(io.confluent.ksql.parser.tree.CreateTableAsSelect) Interval(org.antlr.v4.runtime.misc.Interval) StreamsList(io.confluent.ksql.rest.entity.StreamsList) Produces(javax.ws.rs.Produces) AbstractStreamCreateStatement(io.confluent.ksql.parser.tree.AbstractStreamCreateStatement) LoggerFactory(org.slf4j.LoggerFactory) Path(javax.ws.rs.Path) TimeoutException(java.util.concurrent.TimeoutException) KsqlEngine(io.confluent.ksql.KsqlEngine) KsqlParser(io.confluent.ksql.parser.KsqlParser) KafkaTopicsList(io.confluent.ksql.rest.entity.KafkaTopicsList) SourceDescription(io.confluent.ksql.rest.entity.SourceDescription) KafkaTopicClient(io.confluent.ksql.util.KafkaTopicClient) MediaType(javax.ws.rs.core.MediaType) KsqlTopic(io.confluent.ksql.metastore.KsqlTopic) CommandId(io.confluent.ksql.rest.server.computation.CommandId) Pair(io.confluent.ksql.util.Pair) Consumes(javax.ws.rs.Consumes) CreateTable(io.confluent.ksql.parser.tree.CreateTable) Explain(io.confluent.ksql.parser.tree.Explain) Map(java.util.Map) RegisterTopic(io.confluent.ksql.parser.tree.RegisterTopic) KsqlStream(io.confluent.ksql.metastore.KsqlStream) QueryId(io.confluent.ksql.query.QueryId) DropTopic(io.confluent.ksql.parser.tree.DropTopic) PersistentQueryMetadata(io.confluent.ksql.util.PersistentQueryMetadata) DdlCommandResult(io.confluent.ksql.ddl.commands.DdlCommandResult) QueryMetadata(io.confluent.ksql.util.QueryMetadata) CommandStatus(io.confluent.ksql.rest.entity.CommandStatus) PropertiesList(io.confluent.ksql.rest.entity.PropertiesList) DropStream(io.confluent.ksql.parser.tree.DropStream) Collection(java.util.Collection) KsqlTable(io.confluent.ksql.metastore.KsqlTable) KafkaConsumerGroupClient(io.confluent.ksql.util.KafkaConsumerGroupClient) Collectors(java.util.stream.Collectors) ErrorMessageEntity(io.confluent.ksql.rest.entity.ErrorMessageEntity) List(java.util.List) Response(javax.ws.rs.core.Response) SetProperty(io.confluent.ksql.parser.tree.SetProperty) TopicDescription(io.confluent.ksql.rest.entity.TopicDescription) KafkaConsumerGroupClientImpl(io.confluent.ksql.util.KafkaConsumerGroupClientImpl) TerminateQuery(io.confluent.ksql.parser.tree.TerminateQuery) DdlCommandExec(io.confluent.ksql.ddl.commands.DdlCommandExec) DdlCommand(io.confluent.ksql.ddl.commands.DdlCommand) KsqlException(io.confluent.ksql.util.KsqlException) Statement(io.confluent.ksql.parser.tree.Statement) KsqlRequest(io.confluent.ksql.rest.entity.KsqlRequest) DdlStatement(io.confluent.ksql.parser.tree.DdlStatement) ListTopics(io.confluent.ksql.parser.tree.ListTopics) KsqlRestApplication(io.confluent.ksql.rest.server.KsqlRestApplication) HashMap(java.util.HashMap) KsqlEntityList(io.confluent.ksql.rest.entity.KsqlEntityList) RegisterTopicCommand(io.confluent.ksql.ddl.commands.RegisterTopicCommand) CreateStreamAsSelect(io.confluent.ksql.parser.tree.CreateStreamAsSelect) ListProperties(io.confluent.ksql.parser.tree.ListProperties) ArrayList(java.util.ArrayList) KsqlEntity(io.confluent.ksql.rest.entity.KsqlEntity) CreateStream(io.confluent.ksql.parser.tree.CreateStream) CharStream(org.antlr.v4.runtime.CharStream) ShowColumns(io.confluent.ksql.parser.tree.ShowColumns) KsqlStructuredDataOutputNode(io.confluent.ksql.planner.plan.KsqlStructuredDataOutputNode) Queries(io.confluent.ksql.rest.entity.Queries) TablesList(io.confluent.ksql.rest.entity.TablesList) StatementExecutor(io.confluent.ksql.rest.server.computation.StatementExecutor) DropSourceCommand(io.confluent.ksql.ddl.commands.DropSourceCommand) ListTables(io.confluent.ksql.parser.tree.ListTables) DropTable(io.confluent.ksql.parser.tree.DropTable) POST(javax.ws.rs.POST) ListStreams(io.confluent.ksql.parser.tree.ListStreams) RunScript(io.confluent.ksql.parser.tree.RunScript) ListQueries(io.confluent.ksql.parser.tree.ListQueries) CommandStatusEntity(io.confluent.ksql.rest.entity.CommandStatusEntity) ListRegisteredTopics(io.confluent.ksql.parser.tree.ListRegisteredTopics) DropTopicCommand(io.confluent.ksql.ddl.commands.DropTopicCommand) CreateStreamCommand(io.confluent.ksql.ddl.commands.CreateStreamCommand) CommandStore(io.confluent.ksql.rest.server.computation.CommandStore) DataSource(io.confluent.ksql.serde.DataSource) TimeUnit(java.util.concurrent.TimeUnit) KsqlTopicsList(io.confluent.ksql.rest.entity.KsqlTopicsList) CreateAsSelect(io.confluent.ksql.parser.tree.CreateAsSelect) StructuredDataSource(io.confluent.ksql.metastore.StructuredDataSource) AvroUtil(io.confluent.ksql.util.AvroUtil) Collections(java.util.Collections) SqlBaseParser(io.confluent.ksql.parser.SqlBaseParser) StructuredDataSource(io.confluent.ksql.metastore.StructuredDataSource) KsqlException(io.confluent.ksql.util.KsqlException) PersistentQueryMetadata(io.confluent.ksql.util.PersistentQueryMetadata) SourceDescription(io.confluent.ksql.rest.entity.SourceDescription)

Aggregations

KsqlEngine (io.confluent.ksql.KsqlEngine)1 CreateStreamCommand (io.confluent.ksql.ddl.commands.CreateStreamCommand)1 CreateTableCommand (io.confluent.ksql.ddl.commands.CreateTableCommand)1 DdlCommand (io.confluent.ksql.ddl.commands.DdlCommand)1 DdlCommandExec (io.confluent.ksql.ddl.commands.DdlCommandExec)1 DdlCommandResult (io.confluent.ksql.ddl.commands.DdlCommandResult)1 DropSourceCommand (io.confluent.ksql.ddl.commands.DropSourceCommand)1 DropTopicCommand (io.confluent.ksql.ddl.commands.DropTopicCommand)1 RegisterTopicCommand (io.confluent.ksql.ddl.commands.RegisterTopicCommand)1 KsqlStream (io.confluent.ksql.metastore.KsqlStream)1 KsqlTable (io.confluent.ksql.metastore.KsqlTable)1 KsqlTopic (io.confluent.ksql.metastore.KsqlTopic)1 StructuredDataSource (io.confluent.ksql.metastore.StructuredDataSource)1 KsqlParser (io.confluent.ksql.parser.KsqlParser)1 SqlBaseParser (io.confluent.ksql.parser.SqlBaseParser)1 AbstractStreamCreateStatement (io.confluent.ksql.parser.tree.AbstractStreamCreateStatement)1 CreateAsSelect (io.confluent.ksql.parser.tree.CreateAsSelect)1 CreateStream (io.confluent.ksql.parser.tree.CreateStream)1 CreateStreamAsSelect (io.confluent.ksql.parser.tree.CreateStreamAsSelect)1 CreateTable (io.confluent.ksql.parser.tree.CreateTable)1