static void testDistRule() { String query = "Edge(int a:0..100,(int b)).\n" + "InEdge(int a:0..100,(int b)).\n" + "Edge(s,t) :- s=1, t=99.\n" + "InEdge(t,s) :- Edge(s,t).\n" + "?-InEdge(s,t).\n"; Parser p = new Parser(); p.parse(query); TestAnalysis an = new TestAnalysis(p); an.setDistributed(); an.run(); for (Table t : an.getRemoteTables()) { Assert.true_(t instanceof RemoteHeadTable); Column c = t.getColumn(0); Assert.not_true(c.hasRange(), "RemoteTables are not array-tables"); } }
static void testNestedTable() { String query = "Triangle(int h,(int x, int y, int z)).\n" + "Edge(int s,int t).\n"; Parser p = new Parser(); p.parse(query); Analysis an = new Analysis(p); an.run(); Table triangle = an.getTableMap().get("Triangle"); Column col = triangle.getColumn(0); Assert.true_(col.isPrimaryShard()); col = triangle.getColumn(1); Assert.not_true(col.isPrimaryShard()); List<ColumnGroup> cg = triangle.getColumnGroups(); Assert.true_(cg.size() == 2); Table edge = an.getTableMap().get("Edge"); cg = edge.getColumnGroups(); Assert.true_(cg.size() == 1); }