use of org.apache.calcite.linq4j.tree.ParameterExpression in project calcite by apache.
the class OptimizerTest method testOrElseXX.
@Test
void testOrElseXX() {
// x || x
ParameterExpression x = Expressions.parameter(boolean.class, "x");
assertEquals("{\n return x;\n}\n", optimize(Expressions.orElse(x, x)));
}
use of org.apache.calcite.linq4j.tree.ParameterExpression in project calcite by apache.
the class OptimizerTest method testOptimizeTernaryAeqBBA.
@Test
void testOptimizeTernaryAeqBBA() {
// a == b ? b : a
ParameterExpression a = Expressions.parameter(boolean.class, "a");
ParameterExpression b = Expressions.parameter(boolean.class, "b");
assertEquals("{\n return a;\n}\n", optimize(Expressions.condition(Expressions.equal(a, b), b, a)));
}
use of org.apache.calcite.linq4j.tree.ParameterExpression in project calcite by apache.
the class OptimizerTest method testNotEqualObjectNull.
@Test
void testNotEqualObjectNull() {
// (Integer) x == null
ParameterExpression x = Expressions.parameter(Integer.class, "x");
assertEquals("{\n return x != null;\n}\n", optimize(Expressions.notEqual(x, NULL)));
}
use of org.apache.calcite.linq4j.tree.ParameterExpression in project calcite by apache.
the class OptimizerTest method testAndAlsoXX.
@Test
void testAndAlsoXX() {
// x && x
ParameterExpression x = Expressions.parameter(boolean.class, "x");
assertEquals("{\n return x;\n}\n", optimize(Expressions.andAlso(x, x)));
}
use of org.apache.calcite.linq4j.tree.ParameterExpression in project Mycat2 by MyCATApache.
the class MycatTableScan method implement.
@Override
public Result implement(MycatEnumerableRelImplementor implementor, Prefer pref) {
final BlockBuilder builder = new BlockBuilder();
final PhysType physType = PhysTypeImpl.of(implementor.getTypeFactory(), getRowType(), JavaRowFormat.ARRAY);
ParameterExpression root = implementor.getRootExpression();
TableScan tableScan = (TableScan) this.relNode;
MycatLogicTable mycatLogicTable = (MycatLogicTable) tableScan.getTable().unwrap(AbstractMycatTable.class);
TableHandler table = mycatLogicTable.getTable();
Method getObservable = Types.lookupMethod(NewMycatDataContext.class, "getTableObservable", String.class, String.class);
builder.add(Expressions.call(root, getObservable, Expressions.constant(table.getSchemaName()), Expressions.constant(table.getTableName())));
return implementor.result(physType, builder.toBlock());
}
Aggregations