/** * 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; }
/** * Determines whether it is possible to implement an expression in Java. * * @param rel Relational expression * @param expression Expression * @param deep if true, operands of the given expression are tested for translatability as well; * if false only the top level expression is tested * @return whether the expression can be implemented */ public boolean canTranslate(RelNode rel, RexNode expression, boolean deep) { RexToOJTranslator translator = newTranslator(rel); TranslationTester tester = new TranslationTester(translator, deep); return tester.canTranslate(expression); }