use of io.crate.analyze.QuerySpec in project crate by crate.
the class RelationSplitterTest method testScoreCannotBeFetchd.
@Test
public void testScoreCannotBeFetchd() throws Exception {
QuerySpec querySpec = new QuerySpec().outputs(Arrays.asList(asSymbol("t1._score"), asSymbol("a")));
RelationSplitter splitter = split(querySpec);
assertThat(splitter.canBeFetched(), containsInAnyOrder(asSymbol("a")));
}
use of io.crate.analyze.QuerySpec in project crate by crate.
the class RelationSplitterTest method testMatchWithColumnsFrom2Relations.
@Test
public void testMatchWithColumnsFrom2Relations() throws Exception {
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("Must not use columns from more than 1 relation inside the MATCH predicate");
QuerySpec querySpec = fromQuery("match ((a, b), 'search term')");
split(querySpec);
}
use of io.crate.analyze.QuerySpec in project crate by crate.
the class SelectPlannerTest method testNoSoftLimitOnUnlimitedChildRelation.
@Test
public void testNoSoftLimitOnUnlimitedChildRelation() throws Exception {
int softLimit = 10_000;
EvaluatingNormalizer normalizer = EvaluatingNormalizer.functionOnlyNormalizer(e.functions(), ReplaceMode.COPY);
Planner.Context plannerContext = new Planner.Context(e.planner, clusterService, UUID.randomUUID(), null, normalizer, new TransactionContext(SessionContext.SYSTEM_SESSION), softLimit, 0);
Limits limits = plannerContext.getLimits(new QuerySpec());
assertThat(limits.finalLimit(), is(TopN.NO_LIMIT));
}
use of io.crate.analyze.QuerySpec in project crate by crate.
the class QueriedDocTableFetchPushDownTest method testPushDownWithOrder.
@Test
public void testPushDownWithOrder() throws Exception {
QuerySpec qs = new QuerySpec();
qs.outputs(Lists.newArrayList(REF_A, REF_I));
qs.orderBy(new OrderBy(Lists.newArrayList(REF_I), new boolean[] { true }, new Boolean[] { false }));
QueriedDocTableFetchPushDown pd = new QueriedDocTableFetchPushDown(new QueriedDocTable(TABLE_REL, qs));
QueriedDocTable sub = pd.pushDown();
assertThat(qs, isSQL("SELECT FETCH(INPUT(0), s.t._doc['a']), INPUT(1) ORDER BY INPUT(1) DESC NULLS LAST"));
assertThat(sub.querySpec(), isSQL("SELECT s.t._fetchid, s.t.i ORDER BY s.t.i DESC NULLS LAST"));
}
use of io.crate.analyze.QuerySpec in project crate by crate.
the class QueriedDocTableFetchPushDownTest method testScoreDoesNotRequireFetch.
@Test
public void testScoreDoesNotRequireFetch() throws Exception {
QuerySpec qs = new QuerySpec();
qs.outputs(Lists.newArrayList(REF_I, REF_SCORE));
qs.orderBy(new OrderBy(ImmutableList.of(REF_I), new boolean[] { true }, new Boolean[] { false }));
QueriedDocTableFetchPushDown pd = new QueriedDocTableFetchPushDown(new QueriedDocTable(TABLE_REL, qs));
assertNull(pd.pushDown());
}
Aggregations