org.apache.calcite.rex.RexBuilder.encodeIntervalOrDecimal()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(75)

本文整理了Java中org.apache.calcite.rex.RexBuilder.encodeIntervalOrDecimal方法的一些代码示例,展示了RexBuilder.encodeIntervalOrDecimal的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RexBuilder.encodeIntervalOrDecimal方法的具体详情如下:
包路径:org.apache.calcite.rex.RexBuilder
类名称:RexBuilder
方法名:encodeIntervalOrDecimal

RexBuilder.encodeIntervalOrDecimal介绍

[英]Casts a decimal's integer representation to a decimal node. If the expression is not the expected integer type, then it is casted first.

An overflow check may be requested to ensure the internal value does not exceed the maximum value of the decimal type.
[中]将十进制的整数表示形式强制转换为十进制节点。如果表达式不是预期的整数类型,则首先将其强制转换。
可能需要进行溢出检查,以确保内部值不超过十进制类型的最大值。

代码示例

代码示例来源:origin: org.apache.calcite/calcite-core

/**
 * 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 decimalType   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
 */
protected RexNode encodeValue(
  RexNode value,
  RelDataType decimalType,
  boolean checkOverflow) {
 return builder.encodeIntervalOrDecimal(
   value, decimalType, checkOverflow);
}

代码示例来源:origin: Qihoo360/Quicksql

/**
 * 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 decimalType   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
 */
protected RexNode encodeValue(
  RexNode value,
  RelDataType decimalType,
  boolean checkOverflow) {
 return builder.encodeIntervalOrDecimal(
   value, decimalType, checkOverflow);
}

相关文章

微信公众号

最新文章

更多