zoudan commented on code in PR #3214:
URL: https://github.com/apache/calcite/pull/3214#discussion_r1203720887
##########
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##########
@@ -5539,6 +5539,72 @@ private static void checkIf(SqlOperatorFixture f) {
f.checkNull("atan2(1, cast(null as double))");
}
+ @Test void testAcoshFunc() {
+ final SqlOperatorFixture f0 = fixture().setFor(SqlLibraryOperators.ACOSH);
+ f0.checkFails("^acosh(1)^",
+ "No match found for function signature ACOSH\\(<NUMERIC>\\)",
+ false);
+ final Consumer<SqlOperatorFixture> consumer = f -> {
+ f.checkType("acosh(1)", "DOUBLE NOT NULL");
+ f.checkType("acosh(cast(1 as Decimal))", "DOUBLE NOT NULL");
+ f.checkType("acosh(case when false then 1 else null end)", "DOUBLE");
+ f.checkType("acosh('abc')", "DOUBLE NOT NULL");
+ f.checkScalarApprox("acosh(1)", "DOUBLE NOT NULL",
+ isWithin(0d, 0.0001d));
+ f.checkScalarApprox("acosh(cast(10 as decimal))", "DOUBLE NOT NULL",
+ isWithin(2.9932d, 0.0001d));
+ f.checkNull("acosh(cast(null as integer))");
+ f.checkNull("acosh(cast(null as double))");
+ f.checkFails("acosh(0.1)",
+ "Input parameter of acosh cannot be small than 1!",
Review Comment:
I found it is because we only check this expression will be successful
during parse and validate. The error message has been ignored, you could see
more details in
https://github.com/apache/calcite/blob/f32289870be80e69dabc5b7e24bd6c777d4eb688/testkit/src/main/java/org/apache/calcite/test/SqlOperatorFixtureImpl.java#L161
Maybe we should improve this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]