This is an automated email from the ASF dual-hosted git repository.
jiajunxie 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 31d66e797d [CALCITE-6273] Add sqrt negative test in SqlOperatorTest
31d66e797d is described below
commit 31d66e797d3ca66d154262b15ee35876804df963
Author: caicancai <[email protected]>
AuthorDate: Sun Feb 18 23:28:52 2024 +0800
[CALCITE-6273] Add sqrt negative test in SqlOperatorTest
---
.../main/java/org/apache/calcite/test/SqlOperatorTest.java | 12 ++++++++++++
1 file changed, 12 insertions(+)
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 2ff72a1697..12052c9a82 100644
--- a/testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java
+++ b/testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java
@@ -6110,6 +6110,18 @@ public class SqlOperatorTest {
isWithin(1.4142d, 0.0001d));
f.checkScalarApprox("sqrt(cast(2 as decimal(2, 0)))", "DOUBLE NOT NULL",
isWithin(1.4142d, 0.0001d));
+ f.checkScalarApprox("sqrt(0)", "DOUBLE NOT NULL",
+ isWithin(0, 0.0001d));
+ f.checkScalarApprox("sqrt(0.1)", "DOUBLE NOT NULL",
+ isWithin(0.31622776601683794, 0.0001d));
+ f.checkScalarApprox("sqrt(2.0/3)", "DOUBLE NOT NULL",
+ isWithin(0.816496580927726, 0.0001d));
+ f.checkScalarApprox("sqrt(cast(10e8 as integer))", "DOUBLE NOT NULL",
+ isWithin(31622.776601683792, 0.0001d));
+ f.checkScalarApprox("sqrt(cast(10e8 as double))", "DOUBLE NOT NULL",
+ isWithin(31622.776601683792, 0.0001d));
+ f.checkScalarApprox("sqrt(-1)", "DOUBLE NOT NULL",
+ "NaN");
f.checkNull("sqrt(cast(null as integer))");
f.checkNull("sqrt(cast(null as double))");
}