use of com.facebook.presto.sql.parser.SqlParser in project presto by prestodb.
the class TestMergeWindows method assertUnitPlan.
private void assertUnitPlan(@Language("SQL") String sql, PlanMatchPattern pattern) {
List<PlanOptimizer> optimizers = ImmutableList.of(new UnaliasSymbolReferences(getMetadata().getFunctionAndTypeManager()), new IterativeOptimizer(new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getCostCalculator(), new TranslateExpressions(getQueryRunner().getMetadata(), new SqlParser()).rules()), new IterativeOptimizer(new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getEstimatedExchangesCostCalculator(), ImmutableSet.<Rule<?>>builder().add(new RemoveRedundantIdentityProjections()).addAll(GatherAndMergeWindows.rules()).build()), new PruneUnreferencedOutputs());
assertPlan(sql, pattern, optimizers);
}
use of com.facebook.presto.sql.parser.SqlParser in project presto by prestodb.
the class TestDynamicFiltersChecker method validatePlan.
private void validatePlan(PlanNode root) {
getQueryRunner().inTransaction(session -> {
// metadata.getCatalogHandle() registers the catalog for the transaction
session.getCatalog().ifPresent(catalog -> metadata.getCatalogHandle(session, catalog));
new DynamicFiltersChecker().validate(root, session, metadata, new SqlParser(), TypeProvider.empty(), WarningCollector.NOOP);
return null;
});
}
use of com.facebook.presto.sql.parser.SqlParser in project presto by prestodb.
the class AbstractTestQueryFramework method init.
@BeforeClass
public void init() throws Exception {
queryRunner = createQueryRunner();
expectedQueryRunner = createExpectedQueryRunner();
sqlParser = new SqlParser();
}
use of com.facebook.presto.sql.parser.SqlParser in project presto by prestodb.
the class RuntimeReorderJoinSides method derivePropertiesRecursively.
private StreamProperties derivePropertiesRecursively(PlanNode node, Metadata metadata, SqlParser parser, Context context) {
PlanNode actual = context.getLookup().resolve(node);
List<StreamProperties> inputProperties = actual.getSources().stream().map(source -> derivePropertiesRecursively(source, metadata, parser, context)).collect(toImmutableList());
return StreamPropertyDerivations.deriveProperties(actual, inputProperties, metadata, context.getSession(), context.getVariableAllocator().getTypes(), parser);
}
use of com.facebook.presto.sql.parser.SqlParser in project presto by prestodb.
the class SimplifyExpressions method createRewrite.
private static ExpressionRewriter createRewrite(Metadata metadata, SqlParser sqlParser) {
requireNonNull(metadata, "metadata is null");
requireNonNull(sqlParser, "sqlParser is null");
LiteralEncoder literalEncoder = new LiteralEncoder(metadata.getBlockEncodingSerde());
return (expression, context) -> rewrite(expression, context.getSession(), context.getVariableAllocator(), metadata, literalEncoder, sqlParser);
}
Aggregations