YiwenWu commented on code in PR #3711:
URL: https://github.com/apache/calcite/pull/3711#discussion_r1509897618
##########
core/src/main/java/org/apache/calcite/util/BuiltInMethod.java:
##########
@@ -510,7 +510,7 @@ public enum BuiltInMethod {
SAFE_MULTIPLY(SqlFunctions.class, "safeMultiply", double.class,
double.class),
SAFE_SUBTRACT(SqlFunctions.class, "safeSubtract", double.class,
double.class),
LOG(SqlFunctions.class, "log", long.class, long.class),
- LOG2(SqlFunctions.class, "log2", long.class),
+ LOGMS(SqlFunctions.class, "logMS", long.class, long.class),
Review Comment:
Why delete `LOG2` here, but `SqlLibraryOperators` has no deletion
##########
core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java:
##########
@@ -2157,6 +2165,23 @@ private static RelDataType
deriveTypeMapFromEntries(SqlOperatorBinding opBinding
OperandTypes.NUMERIC,
SqlFunctionCategory.NUMERIC);
+ /** The "LOG10(numeric)" function. Returns the base 10 logarithm of numeric.
*/
+ @LibraryOperator(libraries = {MYSQL, SPARK})
+ public static final SqlFunction LOG10_MS =
+ SqlBasicFunction.create("LOG10",
+ ReturnTypes.DOUBLE_FORCE_NULLABLE,
+ OperandTypes.NUMERIC,
+ SqlFunctionCategory.NUMERIC);
Review Comment:
I have a question, `LOG10` and `LN` have been defined in
`SqlStdOperatorTable`. Defining functions with the same name and Sqlkind here
may cause `SqlOperatorTable#lookupOperatorOverloads` to find multiple
`overloads`, will this cause SQL validation exceptions?
##########
site/_docs/reference.md:
##########
@@ -2783,7 +2783,10 @@ In the following:
| b f s | LENGTH(string) | Equivalent to
`CHAR_LENGTH(string)`
| h s | LEVENSHTEIN(string1, string2) | Returns the Levenshtein
distance between *string1* and *string2*
| b | LOG(numeric1 [, numeric2 ]) | Returns the logarithm
of *numeric1* to base *numeric2*, or base e if *numeric2* is not present
+| m s | LN(numeric) | Returns the natural
logarithm (base *e*) of *numeric*
Review Comment:
`LN` and `LOG10` are defined in both built-in and engine extension
functions, which may confuse users.
--
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]