Ejemplo n.º 1
0
 /**
  * Creates an expression which references correlating variable <code>
  * correlName</code> from the context of <code>rel</code>. For example, if <code>correlName</code>
  * is set by the 1st child of <code>rel</code>'s 2nd child, then this method returns <code>
  * $input2.$input1</code>.
  */
 public Expression makeReference(String correlName, RelNode rel) {
   JavaFrame frame = (JavaFrame) mapCorrel2Frame.get(correlName);
   assert (frame != null);
   assert Util.equal(frame.rel.getCorrelVariable(), correlName);
   assert (frame.hasVariable());
   return frame.getVariable();
 }
Ejemplo n.º 2
0
 /**
  * Records the fact that instances of <code>rel</code> are available via <code>bind</code> (which
  * may be eager or lazy).
  */
 private void bind(RelNode rel, Bind bind) {
   tracer.log(Level.FINE, "Bind " + rel.toString() + " to " + bind);
   JavaFrame frame = (JavaFrame) mapRel2Frame.get(rel);
   frame.bind = bind;
   boolean stupid = SaffronProperties.instance().stupid.get();
   if (stupid) {
     // trigger the declaration of the variable, even though it
     // may not be used
     Util.discard(bind.getVariable());
   }
 }
Ejemplo n.º 3
0
 /**
  * Returns the variable which, in the generated program, will hold the current row of a given
  * relational expression. This method is only applicable if the relational expression is the
  * current one or an input; if it is an ancestor, there is no current value, and this method
  * returns null.
  */
 public Variable findInputVariable(RelNode rel) {
   while (true) {
     JavaFrame frame = (JavaFrame) mapRel2Frame.get(rel);
     if ((frame != null) && frame.hasVariable()) {
       return frame.getVariable();
     }
     List<RelNode> inputs = rel.getInputs();
     if (inputs.size() == 1) {
       rel = inputs.get(0);
     } else {
       return null;
     }
   }
 }
Ejemplo n.º 4
0
 public Variable getVariable() {
   final JavaFrame frame = findFrame();
   return frame.getVariable();
 }