/** * Returns the type for a histogram function. It is either the actual * type or an an approximation to it. */ private RelDataType computeHistogramType(RelDataType type) { if (SqlTypeUtil.isExactNumeric(type) && type.getSqlTypeName() != SqlTypeName.BIGINT) { return typeFactory.createSqlType(SqlTypeName.BIGINT); } else if (SqlTypeUtil.isApproximateNumeric(type) && type.getSqlTypeName() != SqlTypeName.DOUBLE) { return typeFactory.createSqlType(SqlTypeName.DOUBLE); } else { return type; } } }
if (SqlTypeUtil.isExactNumeric(type)) { BigDecimal roundedValue = NumberUtil.rescaleBigDecimal(
/** * @return true if type is numeric */ public static boolean isNumeric(RelDataType type) { return isExactNumeric(type) || isApproximateNumeric(type); }
/** * @return true if type is numeric */ public static boolean isNumeric(RelDataType type) { return isExactNumeric(type) || isApproximateNumeric(type); }
/** * Convenience method for reading characteristics of operands (such as * scale, precision, whole digits) into an ArithmeticExpander. The * operands are restricted by the following contraints: * * <ul> * <li>there are exactly two operands * <li>both are exact numeric types * </ul> */ private void analyzeOperands(List<RexNode> operands) { assert operands.size() == 2; typeA = operands.get(0).getType(); typeB = operands.get(1).getType(); assert SqlTypeUtil.isExactNumeric(typeA) && SqlTypeUtil.isExactNumeric(typeB); scaleA = typeA.getScale(); scaleB = typeB.getScale(); }
/** * Convenience method for reading characteristics of operands (such as * scale, precision, whole digits) into an ArithmeticExpander. The * operands are restricted by the following contraints: * * <ul> * <li>there are exactly two operands * <li>both are exact numeric types * </ul> */ private void analyzeOperands(List<RexNode> operands) { assert operands.size() == 2; typeA = operands.get(0).getType(); typeB = operands.get(1).getType(); assert (SqlTypeUtil.isExactNumeric(typeA) && SqlTypeUtil.isExactNumeric(typeB)); scaleA = typeA.getScale(); scaleB = typeB.getScale(); }
RelDataType type2) if (SqlTypeUtil.isExactNumeric(type1) && SqlTypeUtil.isExactNumeric(type2))
RelDataType type1, RelDataType type2) { if (SqlTypeUtil.isExactNumeric(type1) && SqlTypeUtil.isExactNumeric(type2)) { if (SqlTypeUtil.isDecimal(type1) || SqlTypeUtil.isDecimal(type2)) {
RelDataType type2) if (SqlTypeUtil.isExactNumeric(type1) && SqlTypeUtil.isExactNumeric(type2))
RelDataType type1, RelDataType type2) { if (SqlTypeUtil.isExactNumeric(type1) && SqlTypeUtil.isExactNumeric(type2)) { if (SqlTypeUtil.isDecimal(type1) || SqlTypeUtil.isDecimal(type2)) {
if (SqlTypeUtil.isExactNumeric(type1) && SqlTypeUtil.isExactNumeric(type2))
RelDataType type1 = opBinding.getOperandType(0); RelDataType type2 = opBinding.getOperandType(1); if (SqlTypeUtil.isExactNumeric(type1) && SqlTypeUtil.isExactNumeric(type2)) { if (SqlTypeUtil.isDecimal(type1) || SqlTypeUtil.isDecimal(type2)) {
/** * Returns the type for a histogram function. It is either the actual * type or an an approximation to it. */ private RelDataType computeHistogramType(RelDataType type) { if (SqlTypeUtil.isExactNumeric(type) && (type.getSqlTypeName() != SqlTypeName.BIGINT)) { return new BasicSqlType(SqlTypeName.BIGINT); } else if ( SqlTypeUtil.isApproximateNumeric(type) && (type.getSqlTypeName() != SqlTypeName.DOUBLE)) { return new BasicSqlType(SqlTypeName.DOUBLE); } else { return type; } } }
private RexNode expandMod(RexCall call, List<RexNode> operands) { assert SqlTypeUtil.isExactNumeric(typeA); assert SqlTypeUtil.isExactNumeric(typeB); if (scaleA != 0 || scaleB != 0) { throw RESOURCE.argumentMustHaveScaleZero(call.getOperator().getName()) .ex(); } RexNode result = builder.makeCall( call.getOperator(), accessValue(operands.get(0)), accessValue(operands.get(1))); RelDataType retType = call.getType(); if (SqlTypeUtil.isDecimal(retType)) { return encodeValue(result, retType); } return ensureType( call.getType(), result); } }
/** * Returns the type for a histogram function. It is either the actual * type or an an approximation to it. */ private RelDataType computeHistogramType(RelDataType type) { if (SqlTypeUtil.isExactNumeric(type) && (type.getSqlTypeName() != SqlTypeName.BIGINT)) { return new BasicSqlType(SqlTypeName.BIGINT); } else if ( SqlTypeUtil.isApproximateNumeric(type) && (type.getSqlTypeName() != SqlTypeName.DOUBLE)) { return new BasicSqlType(SqlTypeName.DOUBLE); } else { return type; } } }
private RexNode expandMod(RexCall call, List<RexNode> operands) { assert SqlTypeUtil.isExactNumeric(typeA); assert SqlTypeUtil.isExactNumeric(typeB); if ((scaleA != 0) || (scaleB != 0)) { throw EigenbaseResource.instance().ArgumentMustHaveScaleZero.ex( call.getOperator().getName()); } RexNode result = builder.makeCall( call.getOperator(), accessValue(operands.get(0)), accessValue(operands.get(1))); RelDataType retType = call.getType(); if (SqlTypeUtil.isDecimal(retType)) { return encodeValue(result, retType); } return ensureType( call.getType(), result); } }
&& SqlTypeUtil.isExactNumeric(exp.getType())) } else if (SqlTypeUtil.isExactNumeric(type) && SqlTypeUtil.isInterval(exp.getType())) && SqlTypeUtil.isExactNumeric(exp.getType())) && SqlTypeUtil.isExactNumeric(type))
&& SqlTypeUtil.isExactNumeric(exp.getType())) { return makeCastExactToInterval(type, exp); } else if (SqlTypeUtil.isExactNumeric(type) && SqlTypeUtil.isInterval(exp.getType())) { return makeCastIntervalToExact(type, exp); } else if (sqlType == SqlTypeName.BOOLEAN && SqlTypeUtil.isExactNumeric(exp.getType())) { return makeCastExactToBoolean(type, exp); } else if (exp.getType().getSqlTypeName() == SqlTypeName.BOOLEAN && SqlTypeUtil.isExactNumeric(type)) { return makeCastBooleanToExact(type, exp);
if (SqlTypeUtil.isExactNumeric(type)) { BigDecimal roundedValue = NumberUtil.rescaleBigDecimal(
if (SqlTypeUtil.isExactNumeric(type)) { BigDecimal roundedValue = NumberUtil.rescaleBigDecimal(