/** Creates a LogicalValues that outputs one row and one column. */ public static LogicalValues createOneRow(RelOptCluster cluster) { final RelDataType rowType = cluster.getTypeFactory().builder() .add("ZERO", SqlTypeName.INTEGER).nullable(false) .build(); final ImmutableList<ImmutableList<RexLiteral>> tuples = ImmutableList.of( ImmutableList.of( cluster.getRexBuilder().makeExactLiteral(BigDecimal.ZERO, rowType.getFieldList().get(0).getType()))); return create(cluster, rowType, tuples); }
/** Creates a LogicalValues that outputs one row and one column. */ public static LogicalValues createOneRow(RelOptCluster cluster) { final RelDataType rowType = cluster.getTypeFactory().builder() .add("ZERO", SqlTypeName.INTEGER).nullable(false) .build(); final ImmutableList<ImmutableList<RexLiteral>> tuples = ImmutableList.of( ImmutableList.of( cluster.getRexBuilder().makeExactLiteral(BigDecimal.ZERO, rowType.getFieldList().get(0).getType()))); return create(cluster, rowType, tuples); }
@Test public void testSimplifyUnknown() { final RelDataType intType = typeFactory.createSqlType(SqlTypeName.INTEGER); final RelDataType rowType = typeFactory.builder() .add("a", intType).nullable(true) .build();
@Test public void testSimplifyUnknown() { final RelDataType intType = typeFactory.createSqlType(SqlTypeName.INTEGER); final RelDataType rowType = typeFactory.builder() .add("a", intType).nullable(true) .build();
@Test public void testSimplifyAnd3() { final RelDataType boolType = typeFactory.createSqlType(SqlTypeName.BOOLEAN); final RelDataType rowType = typeFactory.builder() .add("a", boolType).nullable(true) .build(); final RexDynamicParam range = rexBuilder.makeDynamicParam(rowType, 0); final RexNode aRef = rexBuilder.makeFieldAccess(range, 0); // in the case of 3-valued logic, the result must be unknown if a is unknown checkSimplify2( and(aRef, not(aRef)), "AND(null, IS NULL(?0.a))", "false"); }
@Test public void testSimplifyAnd3() { final RelDataType boolType = typeFactory.createSqlType(SqlTypeName.BOOLEAN); final RelDataType rowType = typeFactory.builder() .add("a", boolType).nullable(true) .build(); final RexDynamicParam range = rexBuilder.makeDynamicParam(rowType, 0); final RexNode aRef = rexBuilder.makeFieldAccess(range, 0); // in the case of 3-valued logic, the result must be unknown if a is unknown checkSimplify3( and(aRef, not(aRef)), "AND(null, IS NULL(?0.a))", "false", "AND(null, IS NULL(?0.a))"); }