本文整理匯總了Java中org.apache.calcite.linq4j.tree.BinaryExpression類的典型用法代碼示例。如果您正苦於以下問題:Java BinaryExpression類的具體用法?Java BinaryExpression怎麽用?Java BinaryExpression使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BinaryExpression類屬於org.apache.calcite.linq4j.tree包,在下文中一共展示了BinaryExpression類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testTestCustomOptimizer
import org.apache.calcite.linq4j.tree.BinaryExpression; //導入依賴的package包/類
@Test public void testTestCustomOptimizer() {
BlockBuilder b = new BlockBuilder() {
@Override protected Shuttle createOptimizeShuttle() {
return new OptimizeShuttle() {
@Override public Expression visit(BinaryExpression binary,
Expression expression0, Expression expression1) {
if (binary.getNodeType() == ExpressionType.Add
&& ONE.equals(expression0) && TWO.equals(expression1)) {
return FOUR;
}
return super.visit(binary, expression0, expression1);
}
};
}
};
b.add(Expressions.return_(null, Expressions.add(ONE, TWO)));
assertEquals("{\n return 4;\n}\n", b.toBlock().toString());
}
示例2: binary
import org.apache.calcite.linq4j.tree.BinaryExpression; //導入依賴的package包/類
private RexNode binary(Expression expression, SqlBinaryOperator op) {
BinaryExpression call = (BinaryExpression) expression;
return rexBuilder.makeCall(type(call), op,
toRex(ImmutableList.of(call.expression0, call.expression1)));
}