Skip to content

Commit 6f1bbb0

Browse files
committed
Convert interval to double if it is BigDecimal for further calculation
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
1 parent b65f780 commit 6f1bbb0

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

core/src/main/java/org/opensearch/sql/expression/function/udf/SpanFunction.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,12 @@ public Expression implement(
8080
Expression interval = translatedOperands.get(1);
8181

8282
RelDataType fieldType = call.getOperands().get(0).getType();
83+
RelDataType intervalType = call.getOperands().get(1).getType();
8384
RelDataType unitType = call.getOperands().get(2).getType();
8485

86+
if (SqlTypeUtil.isDecimal(intervalType)) {
87+
interval = Expressions.call(interval, "doubleValue");
88+
}
8589
if (SqlTypeUtil.isNull(unitType)) {
8690
return switch (call.getType().getSqlTypeName()) {
8791
case BIGINT, INTEGER, SMALLINT, TINYINT -> Expressions.multiply(

0 commit comments

Comments
 (0)