Exemplo 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;
   }
 }
Exemplo n.º 2
0
 @Override
 public String visitInputRef(RexInputRef rexInputRef) {
   String name = reserveName();
   String typeName = javaTypeName(rexInputRef);
   pw.print(
       String.format(
           "%s %s = (%s)(_data.get(%d));\n", typeName, name, typeName, rexInputRef.getIndex()));
   return name;
 }
Exemplo n.º 3
0
 @Override
 public Void visitInputRef(RexInputRef inputRef) {
   inputRefSet.add(inputRef.getIndex());
   return null;
 }