You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by GitBox <gi...@apache.org> on 2022/03/02 22:34:51 UTC

[GitHub] [drill] cgivre commented on a change in pull request #2461: DRILL-8136: Overload existing Math UDFs to allow for VARCHAR input

cgivre commented on a change in pull request #2461:
URL: https://github.com/apache/drill/pull/2461#discussion_r818160418



##########
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:
       Yeah, I don't think it's necessary. 




-- 
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: dev-unsubscribe@drill.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org