use of com.facebook.presto.sql.analyzer.MaterializedViewQueryOptimizer in project presto by prestodb.
the class MaterializedViewOptimizationRewriteUtils method getQueryWithMaterializedViewOptimization.
private static Query getQueryWithMaterializedViewOptimization(Metadata metadata, Session session, SqlParser sqlParser, AccessControl accessControl, Query statement, QualifiedObjectName materializedViewQualifiedObjectName) {
ConnectorMaterializedViewDefinition materializedView = metadata.getMaterializedView(session, materializedViewQualifiedObjectName).get();
Table materializedViewTable = new Table(QualifiedName.of(materializedView.getTable()));
Query materializedViewDefinition = (Query) sqlParser.createStatement(materializedView.getOriginalSql());
return (Query) new MaterializedViewQueryOptimizer(metadata, session, sqlParser, accessControl, new RowExpressionDomainTranslator(metadata), materializedViewTable, materializedViewDefinition).rewrite(statement);
}
Aggregations