Github user twalthr commented on a diff in the pull request:
https://github.com/apache/flink/pull/4127#discussion_r160629246
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/runtime/functions/ScalarFunctions.scala
---
@@ -104,9 +103,84 @@ object ScalarFunctions {
}
if (base <= 1.0) {
throw new IllegalArgumentException(s"base of 'log(base, x)' must be
> 1, but base = $base")
- }
- else {
+ } else {
Math.log(x) / Math.log(base)
}
}
+
+ /**
+ * Returns the string str, left-padded with the string pad to a length
of len characters.
+ * If str is longer than len, the return value is shortened to len
characters.
+ */
+ def lpad(base: String, len: Integer, pad: String): String = {
+ if (base == null || len == null || pad == null) {
--- End diff --
`addSqlFunctionMethod` already checks for null in the arguments so we can
use primitive integer here and remove this checks.
---