use of io.crate.analyze.symbol.SelectSymbol in project crate by crate.
the class SubSelectSymbolReplacerTest method testSelectSymbolsAreReplacedInSelectListOfPrimaryKeyLookups.
@Test
public void testSelectSymbolsAreReplacedInSelectListOfPrimaryKeyLookups() throws Exception {
MultiPhasePlan plan = e.plan("select (select 'foo' from sys.cluster) from users where id = 10");
ESGet esGet = (ESGet) plan.rootPlan();
SelectSymbol subSelect = (SelectSymbol) esGet.outputs().get(0);
SubSelectSymbolReplacer replacer = new SubSelectSymbolReplacer(esGet, subSelect);
replacer.onSuccess(new BytesRef("foo"));
assertThat(esGet.outputs(), contains(isLiteral("foo")));
}
use of io.crate.analyze.symbol.SelectSymbol in project crate by crate.
the class ConsumingPlanner method plan.
@Nullable
public Plan plan(AnalyzedRelation relation, ConsumerContext consumerContext) {
for (Consumer consumer : consumers) {
Plan plan = consumer.consume(relation, consumerContext);
if (plan != null) {
if (relation instanceof QueriedRelation) {
QuerySpec qs = ((QueriedRelation) relation).querySpec();
SubqueryPlanner subqueryPlanner = new SubqueryPlanner(consumerContext.plannerContext());
Map<Plan, SelectSymbol> subQueries = subqueryPlanner.planSubQueries(qs);
return MultiPhasePlan.createIfNeeded(plan, subQueries);
}
return plan;
}
}
ValidationException validationException = consumerContext.validationException();
if (validationException != null) {
throw validationException;
}
return null;
}
Aggregations