caicancai commented on code in PR #3711:
URL: https://github.com/apache/calcite/pull/3711#discussion_r1509098703
##########
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##########
@@ -6280,6 +6280,94 @@ void checkRegexpExtract(SqlOperatorFixture f0,
FunctionAlias functionAlias) {
f0.forEachLibrary(list(SqlLibrary.MYSQL, SqlLibrary.SPARK), consumer);
}
+ /** Test case for
+ * <a
href="https://issues.apache.org/jira/browse/CALCITE-6259">[CALCITE-6259]
+ * Add LOG function (enabled in MYSQL, Spark library)</a>. */
+ @Test void testLogMSFunc() {
+ final SqlOperatorFixture f0 = Fixtures.forOperators(true);
+ f0.checkFails("^log(100, 10)^",
+ "No match found for function signature LOG\\(<NUMERIC>, <NUMERIC>\\)",
false);
+ f0.setFor(SqlLibraryOperators.LOG_MS);
+ final Consumer<SqlOperatorFixture> consumer = f -> {
+ f.checkScalarApprox("log(10, 10)", "DOUBLE",
+ isWithin(1.0, 0.000001));
+ f.checkScalarApprox("log(64, 8)", "DOUBLE",
+ isWithin(2.0, 0.000001));
+ f.checkScalarApprox("log(27,3)", "DOUBLE",
+ isWithin(3.0, 0.000001));
+ f.checkScalarApprox("log(100, 10)", "DOUBLE",
+ isWithin(2.0, 0.000001));
+ f.checkScalarApprox("log(10, 100)", "DOUBLE",
+ isWithin(0.5, 0.000001));
+ f.checkScalarApprox("log(cast(10e6 as double), 10)", "DOUBLE",
+ isWithin(7.0, 0.000001));
+ f.checkScalarApprox("log(cast(10e8 as float), 10)", "DOUBLE",
+ isWithin(9.0, 0.000001));
+ f.checkScalarApprox("log(cast(10e-3 as real), 10)", "DOUBLE",
+ isWithin(-2.0, 0.000001));
+ f.checkNull("log(cast(null as real), 10)");
+ f.checkNull("log(10, cast(null as real))");
+ f.checkNull("log(0, 2)");
+ f.checkNull("log(0,-2)");
+ f.checkNull("log(0, +0.0)");
+ f.checkNull("log(0, 0.0)");
+ f.checkNull("log(null)");
+ f.checkNull("log(cast(null as real))");
+ };
+ f0.forEachLibrary(list(SqlLibrary.MYSQL, SqlLibrary.SPARK), consumer);
+ }
+
+// /** Test case for
+// * <a
href="https://issues.apache.org/jira/browse/CALCITE-6259">[CALCITE-6259]
+// * Add LOG10 function (enabled in MYSQL, Spark library)</a>. */
+// @Test void testLog10MSFunc() {
Review Comment:
@tanclary Do you have any ideas? You can uncomment me and try to debug it.
Thank you
--
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]