/** * Makes an approximate literal of double precision */ protected RexNode makeApproxLiteral(BigDecimal bd) { return builder.makeApproxLiteral(bd); }
/** * Makes an approximate literal of double precision */ protected RexNode makeApproxLiteral(BigDecimal bd) { return builder.makeApproxLiteral(bd); }
/** * Creates a double-precision literal. */ public RexLiteral makeApproxLiteral(BigDecimal bd) { // Validator should catch if underflow is allowed // If underflow is allowed, let underflow become zero if (bd.doubleValue() == 0) { bd = BigDecimal.ZERO; } return makeApproxLiteral(bd, typeFactory.createSqlType(SqlTypeName.DOUBLE)); }
/** * Creates a double-precision literal. */ public RexLiteral makeApproxLiteral(BigDecimal bd) { // Validator should catch if underflow is allowed // If underflow is allowed, let underflow become zero if (bd.doubleValue() == 0) { bd = BigDecimal.ZERO; } return makeApproxLiteral( bd, typeFactory.createSqlType(SqlTypeName.DOUBLE)); }
/** * Creates a RexNode that stores a selectivity value corresponding to the * selectivity of a semijoin. This can be added to a filter to simulate the * effect of the semijoin during costing, but should never appear in a real * plan since it has no physical implementation. * * @param rel the semijoin of interest * @return constructed rexnode */ public static RexNode makeSemiJoinSelectivityRexNode(SemiJoinRel rel) { RexBuilder rexBuilder = rel.getCluster().getRexBuilder(); double selectivity = computeSemiJoinSelectivity( rel.getLeft(), rel.getRight(), rel); RexNode selec = rexBuilder.makeApproxLiteral(new BigDecimal(selectivity)); return rexBuilder.makeCall(ARTIFICIAL_SELECTIVITY_FUNC, selec); }
/** * Creates a RexNode that stores a selectivity value corresponding to the * selectivity of a semijoin. This can be added to a filter to simulate the * effect of the semijoin during costing, but should never appear in a real * plan since it has no physical implementation. * * @param rel the semijoin of interest * * @return constructed rexnode */ public static RexNode makeSemiJoinSelectivityRexNode(SemiJoinRel rel) { RexBuilder rexBuilder = rel.getCluster().getRexBuilder(); double selectivity = computeSemiJoinSelectivity( rel.getLeft(), rel.getRight(), rel); RexNode selec = rexBuilder.makeApproxLiteral(new BigDecimal(selectivity)); return rexBuilder.makeCall(artificialSelectivityFunc, selec); }
final Number number = (Number) o; if (number instanceof Double || number instanceof Float) { return rexBuilder.makeApproxLiteral( BigDecimal.valueOf(number.doubleValue())); } else {
Number number = (Number) value; if (value instanceof Double || value instanceof Float) { return rexBuilder.makeApproxLiteral( BigDecimal.valueOf(number.doubleValue())); } else if (value instanceof BigDecimal) {
Number number = (Number) value; if (value instanceof Double || value instanceof Float) { return rexBuilder.makeApproxLiteral( BigDecimal.valueOf(number.doubleValue())); } else if (value instanceof BigDecimal) {
case REAL: case DOUBLE: return makeApproxLiteral((BigDecimal) value, type); case BOOLEAN: return (Boolean) value ? booleanTrue : booleanFalse;
return rexBuilder.makeApproxLiteral((BigDecimal) value); case CHAR: return rexBuilder.makeCharLiteral((NlsString) value);
case REAL: case DOUBLE: return makeApproxLiteral(BigDecimal.ZERO, type); case BOOLEAN: return booleanFalse;
return rexBuilder.makeApproxLiteral((BigDecimal) value); case CHAR: return rexBuilder.makeCharLiteral((NlsString) value);