Esempio n. 1
0
    private LanguageNode handleOrFunction(FunctionCall fc) {
      ArrayList<Part> subparts = new ArrayList<Part>();
      for (ExpressionNode en : fc.getParameters()) {
        Part p = state.get(en);
        if (p == null) {
          broadening();
          return fc;
        }
        subparts.add(p);
      }
      // now to figure out what we have.  we may have a a bunch of incomplete subexprs,
      // in which case we took a = 1 or a = 2 or a = 3 => a part collection of incompletes
      // or we may have (a = 1 and b = 2) or (a =3 and b =4) ... - likewise
      // or they maybe complete.  regardless, just build a partcollection and move on.
      // sort subparts by table key; if there's more than one let's just set broadening for now
      TableKey tk = null;
      for (Part p : subparts) {
        if (tk == null) tk = p.getTableKey();
        else if (!tk.equals(p.getTableKey())) {
          broadening();
          return fc;
        }
      }
      OredParts op = parent.buildOredParts(fc, subparts);
      if (op.isComplete()) setComplete(op);

      state.put(fc, op);
      return fc;
    }
Esempio n. 2
0
 protected TableKey assertSingleTableKey(List<Part> comps) {
   TableKey tk = null;
   for (Part p : comps) {
     if (tk == null) tk = p.getTableKey();
     else if (!tk.equals(p.getTableKey()))
       throw new SchemaException(Pass.PLANNER, "Mixed table keys for key collector");
   }
   return tk;
 }