use of io.prestosql.sql.planner.PlanSymbolAllocator in project hetu-core by openlookeng.
the class TestWindowNode method setUp.
@BeforeClass
public void setUp() {
planSymbolAllocator = new PlanSymbolAllocator();
columnA = planSymbolAllocator.newSymbol("a", BIGINT);
columnB = planSymbolAllocator.newSymbol("b", BIGINT);
columnC = planSymbolAllocator.newSymbol("c", BIGINT);
sourceNode = new ValuesNode(newId(), ImmutableList.of(columnA, columnB, columnC), ImmutableList.of());
}
use of io.prestosql.sql.planner.PlanSymbolAllocator in project hetu-core by openlookeng.
the class TestExternalFunctionPushDownChecker method setup.
@BeforeClass
public void setup() {
planSymbolAllocator = new PlanSymbolAllocator();
columnA = planSymbolAllocator.newSymbol("a", DOUBLE);
columnB = planSymbolAllocator.newSymbol("b", DOUBLE);
sumCall = call("sum", SUM, DOUBLE, ImmutableList.of(VariableReferenceSymbolConverter.toVariableReference(columnA, DOUBLE)));
externalFooCall1 = new CallExpression("jdbc.v1.foo", EXTERNAL_FOO, DOUBLE, ImmutableList.of());
externalFooCall2 = new CallExpression("jdbc.v1.foo2", EXTERNAL_FOO, DOUBLE, ImmutableList.of());
metadata = getQueryRunner().getMetadata();
builder = new PlanBuilder(new PlanNodeIdAllocator(), metadata);
}
use of io.prestosql.sql.planner.PlanSymbolAllocator in project hetu-core by openlookeng.
the class TestSimplifyExpressions method assertSimplifies.
private static void assertSimplifies(String expression, String expected) {
Expression actualExpression = rewriteIdentifiersToSymbolReferences(SQL_PARSER.createExpression(expression));
Expression expectedExpression = rewriteIdentifiersToSymbolReferences(SQL_PARSER.createExpression(expected));
Expression rewritten = rewrite(actualExpression, TEST_SESSION, new PlanSymbolAllocator(booleanSymbolTypeMapFor(actualExpression)), METADATA, LITERAL_ENCODER, new TypeAnalyzer(SQL_PARSER, METADATA));
assertEquals(normalize(rewritten), normalize(expectedExpression));
}
use of io.prestosql.sql.planner.PlanSymbolAllocator in project hetu-core by openlookeng.
the class RuleAssert method applyRule.
private RuleApplication applyRule() {
PlanSymbolAllocator planSymbolAllocator = new PlanSymbolAllocator(types.allTypes());
Memo memo = new Memo(idAllocator, plan);
Lookup lookup = Lookup.from(planNode -> Stream.of(memo.resolve(planNode)));
PlanNode memoRoot = memo.getNode(memo.getRootGroup());
return inTransaction(session -> applyRule(rule, memoRoot, ruleContext(statsCalculator, costCalculator, planSymbolAllocator, memo, lookup, session)));
}
use of io.prestosql.sql.planner.PlanSymbolAllocator in project hetu-core by openlookeng.
the class TestJoinEnumerator method createContext.
private Rule.Context createContext() {
PlanNodeIdAllocator planNodeIdAllocator = new PlanNodeIdAllocator();
Map<Symbol, Type> symbols = new HashMap<>();
symbols.put(new Symbol("A1"), BIGINT);
symbols.put(new Symbol("B1"), BIGINT);
PlanSymbolAllocator planSymbolAllocator = new PlanSymbolAllocator(symbols);
CachingStatsProvider statsProvider = new CachingStatsProvider(queryRunner.getStatsCalculator(), Optional.empty(), noLookup(), queryRunner.getDefaultSession(), planSymbolAllocator.getTypes());
CachingCostProvider costProvider = new CachingCostProvider(queryRunner.getCostCalculator(), statsProvider, Optional.empty(), queryRunner.getDefaultSession(), planSymbolAllocator.getTypes());
return new Rule.Context() {
@Override
public Lookup getLookup() {
return noLookup();
}
@Override
public PlanNodeIdAllocator getIdAllocator() {
return planNodeIdAllocator;
}
@Override
public PlanSymbolAllocator getSymbolAllocator() {
return planSymbolAllocator;
}
@Override
public Session getSession() {
return queryRunner.getDefaultSession();
}
@Override
public StatsProvider getStatsProvider() {
return statsProvider;
}
@Override
public CostProvider getCostProvider() {
return costProvider;
}
@Override
public void checkTimeoutNotExhausted() {
}
@Override
public WarningCollector getWarningCollector() {
return WarningCollector.NOOP;
}
};
}
Aggregations