Search in sources :

Example 1 with RewrittenAnalysis

use of io.confluent.ksql.analyzer.RewrittenAnalysis in project ksql by confluentinc.

the class KsqlEngine method analyzeQueryWithNoOutputTopic.

/**
 * For analyzing queries that you know won't have an output topic, such as pull queries.
 */
public ImmutableAnalysis analyzeQueryWithNoOutputTopic(final Query query, final String queryText, final Map<String, Object> configOverrides) {
    final KsqlConfig ksqlConfig = this.primaryContext.getKsqlConfig();
    final QueryAnalyzer queryAnalyzer = new QueryAnalyzer(getMetaStore(), "", getRowpartitionRowoffsetEnabled(ksqlConfig, configOverrides), ksqlConfig.getBoolean(KsqlConfig.KSQL_QUERY_PULL_LIMIT_CLAUSE_ENABLED));
    final Analysis analysis;
    try {
        analysis = queryAnalyzer.analyze(query, Optional.empty());
    } catch (final KsqlException e) {
        throw new KsqlStatementException(e.getMessage(), queryText, e);
    }
    return new RewrittenAnalysis(analysis, new QueryExecutionUtil.ColumnReferenceRewriter()::process);
}
Also used : RewrittenAnalysis(io.confluent.ksql.analyzer.RewrittenAnalysis) RewrittenAnalysis(io.confluent.ksql.analyzer.RewrittenAnalysis) ImmutableAnalysis(io.confluent.ksql.analyzer.ImmutableAnalysis) Analysis(io.confluent.ksql.analyzer.Analysis) KsqlConfig(io.confluent.ksql.util.KsqlConfig) QueryAnalyzer(io.confluent.ksql.analyzer.QueryAnalyzer) KsqlStatementException(io.confluent.ksql.util.KsqlStatementException) KsqlException(io.confluent.ksql.util.KsqlException)

Aggregations

Analysis (io.confluent.ksql.analyzer.Analysis)1 ImmutableAnalysis (io.confluent.ksql.analyzer.ImmutableAnalysis)1 QueryAnalyzer (io.confluent.ksql.analyzer.QueryAnalyzer)1 RewrittenAnalysis (io.confluent.ksql.analyzer.RewrittenAnalysis)1 KsqlConfig (io.confluent.ksql.util.KsqlConfig)1 KsqlException (io.confluent.ksql.util.KsqlException)1 KsqlStatementException (io.confluent.ksql.util.KsqlStatementException)1