use of io.crate.analyze.relations.RelationAnalyzer in project crate by crate.
the class CreateViewPlan method ensureFormattedQueryCanStillBeAnalyzed.
private static void ensureFormattedQueryCanStillBeAnalyzed(RelationName viewName, NodeContext nodeCtx, Schemas schemas, CoordinatorTxnCtx txnCtx, String formattedQuery, boolean replaceExisting) {
RelationAnalyzer analyzer = new RelationAnalyzer(nodeCtx, schemas);
Query query = (Query) SqlParser.createStatement(formattedQuery);
if (replaceExisting) {
new EnsureNoSelfReference(viewName, txnCtx.sessionContext().searchPath()).raiseOnSelfReference(query);
}
analyzer.analyze(query, txnCtx, new ParamTypeHints(List.of()) {
@Override
public Symbol apply(@Nullable ParameterExpression input) {
throw new UnsupportedOperationException("View definition must not contain any parameter placeholders");
}
});
}
Aggregations