本文整理汇总了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)));
}