Search in sources :

Example 1 with MultiPhasePlan

use of io.crate.planner.MultiPhasePlan 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")));
}
Also used : SelectSymbol(io.crate.analyze.symbol.SelectSymbol) ESGet(io.crate.planner.node.dql.ESGet) MultiPhasePlan(io.crate.planner.MultiPhasePlan) BytesRef(org.apache.lucene.util.BytesRef) Test(org.junit.Test) CrateUnitTest(io.crate.test.integration.CrateUnitTest)

Aggregations

SelectSymbol (io.crate.analyze.symbol.SelectSymbol)1 MultiPhasePlan (io.crate.planner.MultiPhasePlan)1 ESGet (io.crate.planner.node.dql.ESGet)1 CrateUnitTest (io.crate.test.integration.CrateUnitTest)1 BytesRef (org.apache.lucene.util.BytesRef)1 Test (org.junit.Test)1