estherbuchwalter commented on a change in pull request #2461:
URL: https://github.com/apache/drill/pull/2461#discussion_r818086953
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/MathFunctionsVarcharUtils.java
##########
@@ -18,15 +18,24 @@
package org.apache.drill.exec.expr.fn.impl;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.math.NumberUtils;
+
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-//import static java.lang.Float.NaN;
-
public class MathFunctionsVarcharUtils {
- public String validateInput(String input) {
+ public static boolean isValid(String input) {
+ if (StringUtils.isEmpty(input)) {
+ return false;
+ } else {
+ input = input.trim();
+ return NumberUtils.isCreatable(input);
+ }
+ }
+ public static String validateInput(String input) {
Review comment:
@cgivre, thanks for adding the `NumberUtils.isCreatable` function to
check for a valid number. Should I get rid of the `validateInput()` method?
--
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]