Esempio n. 1
0
 /** Translates a call to a binary operator. Returns whether successful. */
 private boolean translateBinary2(String op, RexNode left, RexNode right) {
   switch (right.getKind()) {
     case LITERAL:
       break;
     default:
       return false;
   }
   final RexLiteral rightLiteral = (RexLiteral) right;
   switch (left.getKind()) {
     case INPUT_REF:
       final RexInputRef left1 = (RexInputRef) left;
       String name = fieldNames.get(left1.getIndex());
       translateOp2(op, name, rightLiteral);
       return true;
     case CAST:
       return translateBinary2(op, ((RexCall) left).operands.get(0), right);
     case OTHER_FUNCTION:
       String itemName = MongoRules.isItem((RexCall) left);
       if (itemName != null) {
         translateOp2(op, itemName, rightLiteral);
         return true;
       }
       // fall through
     default:
       return false;
   }
 }
Esempio n. 2
0
 public void implement(Implementor implementor) {
   implementor.visitChild(0, getInput());
   Translator translator = new Translator(MongoRules.mongoFieldNames(getRowType()));
   String match = translator.translateMatch(condition);
   implementor.add(null, match);
 }