Search in sources :

Example 1 with DataSourceExtractor

use of io.confluent.ksql.engine.rewrite.DataSourceExtractor in project ksql by confluentinc.

the class DeprecatedStatementsChecker method isStream.

private boolean isStream(final Relation relation) {
    // DataSourceExtractor must be initialized everytime we need to extract data from a node
    // because it changes its internal state to keep all sources found
    final DataSourceExtractor dataSourceExtractor = new DataSourceExtractor(metaStore, false);
    // The relation object should have only one joined source, but the extract sources method
    // returns a list. This loop checks all returned values are a Stream just to prevent throwing
    // an exception if more than one value is returned.
    final Set<AliasedDataSource> sources = dataSourceExtractor.extractDataSources(relation);
    if (sources.size() > 1) {
        // Just log a warning in case the relation object has more han one source
        LOG.warn("The deprecation statement checker has detected an internal join source with more " + "than one relation. This might be a bug in the deprecation checker or other part of " + " the code. Report this bug to the ksqlDB support team.");
    }
    for (final AliasedDataSource source : sources) {
        if (source.getDataSource().getDataSourceType() != DataSource.DataSourceType.KSTREAM) {
            return false;
        }
    }
    return true;
}
Also used : AliasedDataSource(io.confluent.ksql.analyzer.Analysis.AliasedDataSource) DataSourceExtractor(io.confluent.ksql.engine.rewrite.DataSourceExtractor)

Aggregations

AliasedDataSource (io.confluent.ksql.analyzer.Analysis.AliasedDataSource)1 DataSourceExtractor (io.confluent.ksql.engine.rewrite.DataSourceExtractor)1