0, reinterpretCast ? rexBuilder.makeReinterpretCast(histogramType, exprs.get(0), rexBuilder.makeLiteral(false)) : rexBuilder.makeCast(histogramType, exprs.get(0))); if (reinterpretCast) { histogramCall = rexBuilder.makeReinterpretCast( type, histogramCall,
/** * Casts a decimal's integer representation to a decimal node. If the * expression is not the expected integer type, then it is casted first. * * <p>An overflow check may be requested to ensure the internal value * does not exceed the maximum value of the decimal type. * * @param value integer representation of decimal * @param type type integer will be reinterpreted as * @param checkOverflow indicates whether an overflow check is required * when reinterpreting this particular value as the * decimal type. A check usually not required for * arithmetic, but is often required for rounding and * explicit casts. * @return the integer reinterpreted as an opaque decimal type */ public RexNode encodeIntervalOrDecimal( RexNode value, RelDataType type, boolean checkOverflow) { RelDataType bigintType = typeFactory.createSqlType( SqlTypeName.BIGINT); RexNode cast = ensureType(bigintType, value, true); return makeReinterpretCast(type, cast, makeLiteral(checkOverflow)); }
/** * Casts a decimal's integer representation to a decimal node. If the * expression is not the expected integer type, then it is casted first. * * <p>An overflow check may be requested to ensure the internal value * does not exceed the maximum value of the decimal type. * * @param value integer representation of decimal * @param type type integer will be reinterpreted as * @param checkOverflow indicates whether an overflow check is required * when reinterpreting this particular value as the decimal type. A * check usually not required for arithmetic, but is often required for * rounding and explicit casts. * * @return the integer reinterpreted as an opaque decimal type */ public RexNode encodeIntervalOrDecimal( RexNode value, RelDataType type, boolean checkOverflow) { RelDataType bigintType = typeFactory.createSqlType( SqlTypeName.BIGINT); RexNode cast = ensureType(bigintType, value, true); return makeReinterpretCast( type, cast, makeLiteral(checkOverflow)); }
/** * Retrieves an interval or decimal node's integer representation * * @param node the interval or decimal value as an opaque type * @return an integer representation of the decimal value */ public RexNode decodeIntervalOrDecimal(RexNode node) { assert SqlTypeUtil.isDecimal(node.getType()) || SqlTypeUtil.isInterval(node.getType()); RelDataType bigintType = typeFactory.createSqlType(SqlTypeName.BIGINT); return makeReinterpretCast( matchNullability(bigintType, node), node, makeLiteral(false)); }
resType, exprs.get(1).getType().isNullable()); RexNode res = rexBuilder.makeReinterpretCast( resType, exprs.get(1), rexBuilder.makeLiteral(false));
/** * Retrieves an interval or decimal node's integer representation * * @param node the interval or decimal value as an opaque type * * @return an integer representation of the decimal value */ public RexNode decodeIntervalOrDecimal(RexNode node) { assert (SqlTypeUtil.isDecimal(node.getType()) || SqlTypeUtil.isInterval(node.getType())); RelDataType bigintType = typeFactory.createSqlType( SqlTypeName.BIGINT); return makeReinterpretCast( matchNullability(bigintType, node), node, makeLiteral(false)); }
resType, exprs.get(1).getType().isNullable()); RexNode cast = rexBuilder.makeReinterpretCast( resType, exprs.get(1), rexBuilder.makeLiteral(false));
0, reinterpretCast ? rexBuilder.makeReinterpretCast(histogramType, exprs.get(0), rexBuilder.makeLiteral(false)) : rexBuilder.makeCast(histogramType, exprs.get(0))); if (reinterpretCast) { histogramCall = rexBuilder.makeReinterpretCast( type, histogramCall,
final RelDataType resType = cx.getValidator().getValidatedNodeType(call); final RexNode res = rexBuilder.makeReinterpretCast( resType, minus,
final RelDataType resType = cx.getValidator().getValidatedNodeType(call); return rexBuilder.makeReinterpretCast( resType, minus,
0, reinterpretCast ? rexBuilder.makeReinterpretCast( histogramType, exprs.get(0), if (reinterpretCast) { histogramCall = rexBuilder.makeReinterpretCast( type, histogramCall,
RexNode cast = rexBuilder.makeReinterpretCast( rexInterval.getType(), pad, rexBuilder.makeLiteral(false)); SqlOperator op =
RexNode cast = rexBuilder.makeReinterpretCast( rexInterval.getType(), pad, rexBuilder.makeLiteral(false)); SqlOperator op =