This is an automated email from the ASF dual-hosted git repository.
mbudiu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git
The following commit(s) were added to refs/heads/main by this push:
new 7ef829e17c [CALCITE-6377] Time expression causes IllegalStateException
7ef829e17c is described below
commit 7ef829e17cf382e34b2c5ee36a664d98a7258c31
Author: Mihai Budiu <[email protected]>
AuthorDate: Fri Apr 19 12:06:02 2024 -0700
[CALCITE-6377] Time expression causes IllegalStateException
Signed-off-by: Mihai Budiu <[email protected]>
---
.../main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java | 1 +
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java | 2 ++
2 files changed, 3 insertions(+)
diff --git
a/core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java
b/core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java
index 2ff47db219..d2d026c9fb 100644
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java
+++ b/core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java
@@ -3655,6 +3655,7 @@ public class RexImpTable {
}
break;
case TIME:
+ trop1 = normalize(typeName, trop1);
trop1 = Expressions.convert_(trop1, int.class);
break;
default:
diff --git a/testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java
b/testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java
index d0e529944d..a7aa550e6f 100644
--- a/testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java
+++ b/testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java
@@ -3449,6 +3449,8 @@ public class SqlOperatorTest {
// make sure that TIME values say in range
f.checkScalar("time '12:03:01' + interval '1' day",
"12:03:01", "TIME(0) NOT NULL");
+ f.checkScalar("time '12:03:01' + interval '25' day",
+ "12:03:01", "TIME(0) NOT NULL");
f.checkScalar("time '12:03:01' + interval '25' hour",
"13:03:01", "TIME(0) NOT NULL");
f.checkScalar("time '12:03:01' + interval '25:0:1' hour to second",