private boolean isTableEmpty(Op op) { if (op instanceof OpTable) { return ((OpTable) op).getTable().isEmpty(); } else { return false; } }
@Override public void visit(OpTable opTable) { push(opTable.getTable()) ; }
@Override public void visit(OpTable opTable) { // Only the variables with values in the tables // (When building, undefs didn't get into bindings so no variable // mentioned) Table t = opTable.getTable() ; // Treat as unknown position unknownAcc.addAll(t.getVars()) ; }
public static boolean isJoinIdentify(Op op) { if ( ! ( op instanceof OpTable ) ) return false ; Table t = ((OpTable)op).getTable() ; // Safe answer. return TableUnit.isTableUnit(t) ; }
@Override public void visit(OpTable opTable) { defines.addAll(opTable.getTable().getVars()); }
@Override public void visit(OpProject opProject) { // The walker (WalkerVisitorVisible) handles this // for visible variables, not mentioned variable collecting. // The visibleOnly/clear is simply to be as general as possible. // visible: OpWalkerVisitorFixed, OpWalkerVisitorVisible, // all (visibleOnly==false) for OpVarsMentioned if (visibleOnly) acc.clear() ; acc.addAll(opProject.getVars()) ; }
@Override public void visit(OpTable opTable) { action(opTable.getTable().getVars()); }
protected QueryIterator execute(OpTable opTable, QueryIterator input) { if (opTable.isJoinIdentity()) return input ; if (input.isJoinIdentity() ) { input.close() ; return opTable.getTable().iterator(execCxt); } QueryIterator qIterT = opTable.getTable().iterator(execCxt) ; QueryIterator qIter = Join.join(input, qIterT, execCxt) ; return qIter ; }
@Override public Op transform(OpTable opTable) { // Always a new object return OpTable.create(opTable.getTable()) ; } };
private Placement placeTable(ExprList exprs, OpTable input) { exprs = ExprList.copy(exprs) ; Op op = insertAnyFilter$(exprs, input.getTable().getVars(), input) ; return result(op, exprs) ; }
@Override public void visit(OpTable opTable) { if ( TableUnit.isTableUnit(opTable.getTable()) ) { start(opTable, NoNL) ; out.print("unit") ; finish(opTable) ; return ; } if ( TableEmpty.isTableEmpty(opTable.getTable()) ) { start(opTable, NoNL) ; out.print("empty") ; finish(opTable) ; return ; } start(opTable, NoNL) ; WriterNode.outputVars(out, opTable.getTable().getVars(), sContext) ; if ( ! opTable.getTable().isEmpty() ) { out.println(); WriterTable.outputPlain(out, opTable.getTable(), sContext) ; } finish(opTable) ; }
@Override public void visit(OpTable opTable) { // This will go in a group so simply forget it. if ( opTable.isJoinIdentity() ) return ; // Put in a VALUES // This may be related to the grpup of the overall query. ElementData el = new ElementData() ; el.getVars().addAll(opTable.getTable().getVars()) ; QueryIterator qIter = opTable.getTable().iterator(null) ; while (qIter.hasNext()) el.getRows().add(qIter.next()) ; qIter.close() ; currentGroup().addElement(el) ; }
@Override public void visit(OpTable opTable) { Table tbl = opTable.getTable(); boolean process = false; for (Var v : tbl.getVars()) { process = process | values.keySet().contains(v); } if (!process) { push(opTable); } else { TableN retTbl = new TableN(tbl.getVars()); Iterator<Binding> iter = tbl.rows(); while (iter.hasNext()) { retTbl.addBinding(rewrite(iter.next())); } push(OpTable.create(retTbl)); } }
@Override public void visit(OpTable opTable) { Table tbl = opTable.getTable(); boolean process = false; for (Var v : tbl.getVars()) { process = process | values.keySet().contains(v); } if (!process) { push(opTable); } else { TableN retTbl = new TableN(tbl.getVars()); Iterator<Binding> iter = tbl.rows(); while (iter.hasNext()) { retTbl.addBinding(rewrite(iter.next())); } push(OpTable.create(retTbl)); } }
@Override public Op transform(OpTable opTable) { if ( opTable.isJoinIdentity() ) return opTable; Table table = opTable.getTable(); if ( table.isEmpty() ) return opTable; if ( TableUnit.isTableUnit(table) ) return opTable; if ( table.getVars().size() == 0 ) return opTable; Table table2 = NodeTransformLib.transform(table, transform); return OpTable.create(table2); }