use of io.crate.analyze.WhereClause in project crate by crate.
the class HandlerSideLevelCollectTest method testInformationSchemaTables.
@Test
public void testInformationSchemaTables() throws Exception {
InformationSchemaInfo schemaInfo = internalCluster().getInstance(InformationSchemaInfo.class);
TableInfo tablesTableInfo = schemaInfo.getTableInfo("tables");
Routing routing = tablesTableInfo.getRouting(WhereClause.MATCH_ALL, null);
List<Symbol> toCollect = new ArrayList<>();
for (Reference reference : tablesTableInfo.columns()) {
toCollect.add(reference);
}
Symbol tableNameRef = toCollect.get(8);
FunctionImplementation eqImpl = functions.get(new FunctionIdent(EqOperator.NAME, ImmutableList.of(DataTypes.STRING, DataTypes.STRING)));
Function whereClause = new Function(eqImpl.info(), Arrays.asList(tableNameRef, Literal.of("shards")));
RoutedCollectPhase collectNode = collectNode(routing, toCollect, RowGranularity.DOC, new WhereClause(whereClause));
Bucket result = collect(collectNode);
assertThat(TestingHelpers.printedTable(result), is("NULL| NULL| strict| 0| 1| NULL| NULL| NULL| shards| sys| NULL\n"));
}
Aggregations