Esempio n. 1
0
 /**
  * Burrows into a synthetic record and returns the underlying relation which provides the field
  * called <code>fieldName</code>.
  */
 public JavaRel implementFieldAccess(JavaRelImplementor implementor, String fieldName) {
   if (!isBoxed()) {
     return implementor.implementFieldAccess((JavaRel) getChild(), fieldName);
   }
   RelDataType type = getRowType();
   int field = type.getFieldOrdinal(fieldName);
   RexLocalRef ref = program.getProjectList().get(field);
   final int index = ref.getIndex();
   return implementor.findRel((JavaRel) this, program.getExprList().get(index));
 }
Esempio n. 2
0
 /**
  * Determines whether it is possible to implement a set of expressions in Java.
  *
  * @param program Program to translate
  * @return whether all expressions in the program can be implemented
  */
 public boolean canTranslate(RelNode rel, RexProgram program) {
   RexToOJTranslator translator = newTranslator(rel);
   TranslationTester tester = new TranslationTester(translator, true);
   final List<RexNode> exprList = program.getExprList();
   for (RexNode expr : exprList) {
     if (!tester.canTranslate(expr)) {
       return false;
     }
   }
   return true;
 }