use of io.crate.analyze.relations.QueriedDocTable in project crate by crate.
the class QueriedDocTableFetchPushDownTest method testPushDownWithNestedOrderInOutput.
@Test
public void testPushDownWithNestedOrderInOutput() throws Exception {
QuerySpec qs = new QuerySpec();
Function funcOfI = abs(REF_I);
qs.outputs(Lists.newArrayList(REF_A, REF_I, funcOfI));
qs.orderBy(new OrderBy(Lists.newArrayList(funcOfI), 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']), FETCH(INPUT(0), s.t._doc['i']), INPUT(1) ORDER BY INPUT(1) DESC NULLS LAST"));
assertThat(sub.querySpec(), isSQL("SELECT s.t._fetchid, abs(s.t.i) ORDER BY abs(s.t.i) DESC NULLS LAST"));
}
Aggregations