use of io.confluent.ksql.util.ReservedInternalTopics in project ksql by confluentinc.
the class InsertValuesExecutor method getDataSource.
private static DataSource getDataSource(final KsqlConfig ksqlConfig, final MetaStore metaStore, final InsertValues insertValues) {
final DataSource dataSource = metaStore.getSource(insertValues.getTarget());
if (dataSource == null) {
throw new KsqlException("Cannot insert values into an unknown stream/table: " + insertValues.getTarget());
}
if (dataSource.getKsqlTopic().getKeyFormat().isWindowed()) {
throw new KsqlException("Cannot insert values into windowed stream/table!");
}
final ReservedInternalTopics internalTopics = new ReservedInternalTopics(ksqlConfig);
if (internalTopics.isReadOnly(dataSource.getKafkaTopicName())) {
throw new KsqlException("Cannot insert values into read-only topic: " + dataSource.getKafkaTopicName());
}
if (dataSource.isSource()) {
throw new KsqlException(String.format("Cannot insert values into read-only %s: %s", dataSource.getDataSourceType().getKsqlType().toLowerCase(), dataSource.getName().text()));
}
return dataSource;
}
use of io.confluent.ksql.util.ReservedInternalTopics in project ksql by confluentinc.
the class ListTopicsExecutor method listTopics.
private static Map<String, TopicDescription> listTopics(final KafkaTopicClient topicClient, final ConfiguredStatement<ListTopics> statement) {
final ReservedInternalTopics internalTopics = new ReservedInternalTopics(statement.getSessionConfig().getConfig(false));
final Set<String> topics = statement.getStatement().getShowAll() ? topicClient.listTopicNames() : internalTopics.removeHiddenTopics(topicClient.listTopicNames());
// TreeMap is used to keep elements sorted
return new TreeMap<>(topicClient.describeTopics(topics));
}
Aggregations