NobiGo commented on code in PR #3955:
URL: https://github.com/apache/calcite/pull/3955#discussion_r1751306340
##########
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##########
@@ -7372,6 +7372,26 @@ void checkRegexpExtract(SqlOperatorFixture f0,
FunctionAlias functionAlias) {
"Cannot take logarithm of zero or negative number", true);
}
+ /** Test case for
+ * <a
href="https://issues.apache.org/jira/browse/CALCITE-6549">[CALCITE-6549]
+ * Add LOG1P function (enabled in Spark library)</a>. */
+ @Test void testLog1PFunc() {
+ final SqlOperatorFixture f0 = fixture()
+ .setFor(SqlLibraryOperators.LOG1P, VmName.EXPAND);
+ f0.checkFails("^log1p(4)^",
+ "No match found for function signature LOG1P\\(<NUMERIC>\\)", false);
+ final SqlOperatorFixture f = f0.withLibrary(SqlLibrary.SPARK);
+ f.checkScalarApprox("log1p(0)", "DOUBLE",
+ isWithin(0.0, 0.000001));
+ f.checkScalarApprox("log1p(1)", "DOUBLE",
+ isWithin(0.6931471805599453, 0.000001));
+ f.checkScalarApprox("log1p(1e+22)", "DOUBLE",
+ isWithin(50.65687204586901, 0.000001));
+ f.checkNull("log1p(cast(null as real))");
+ f.checkNull("log1p(-1)");
+ f.checkNull("log1p(null)");
Review Comment:
Please add tests like:
```
select log1p();
select log1p(1.2);
```
Other changes look good to me.
--
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]