|
@@ -0,0 +1,24 @@
|
|
|
+package com.winhc.bigdata.udf;
|
|
|
+
|
|
|
+import com.aliyun.odps.udf.UDF;
|
|
|
+import com.aliyun.odps.utils.StringUtils;
|
|
|
+
|
|
|
+import java.util.regex.Pattern;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author: XuJiakai
|
|
|
+ * 2020/12/16 16:06
|
|
|
+ */
|
|
|
+public class ConcatCleanup extends UDF {
|
|
|
+ private static final Pattern pattern = Pattern.compile("[^\\u4e00-\\u9fa50-9a-zA-Z]");
|
|
|
+
|
|
|
+ public String evaluate(String... val) {
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ for (String s : val) {
|
|
|
+ if (StringUtils.isNotBlank(s)) {
|
|
|
+ sb.append(pattern.matcher(s).replaceAll(""));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return sb.toString();
|
|
|
+ }
|
|
|
+}
|